Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse not creating JPA entities from table

Tags:

eclipse

jpa

I'm using Eclipse Juno, Hibernate 4.0 and MSSQL 2008. I've created a database and have just gone through the process "JPA Entities from Tables" in Eclipse. About half of the tables did not get created (even though I selected those table), but the classes were added to persistence.xml.

Has anyone else experienced this problem? Do you have a solution?

like image 908
CaptainMorgan Avatar asked Mar 24 '23 06:03

CaptainMorgan


2 Answers

In my case the database was Oracle XE. So mine is a bit different case but may be helpful to someone.

The best way to find the problem with this is to check the logs of workspace present at $workspace_location/.metadata/.log file. In my case I found that there were 3 problems:

1) Caused by: java.io.FileNotFoundException: $MiddlewarePath\oracle_common\modules\oracle.adf.share_11.1.1\adfsharembean.jar (Access is denied)

2) Caused by: java.io.FileNotFoundException: $MiddlewarePath\oracle_common\modules\oracle.ldap_11.1.1\jremtool.jar (Access is denied)

3) !MESSAGE Unable to find JPA entities generation templates in pluginorg.eclipse.jpt.jpa.gen !STACK 1 Java Model Exception: Core Exception [code 275] A resource exists with a different case: '/TestJPAProjectFacetsEJB/src/main/java/com/domainname/ejb/TestJPAProjectFacets'.

Hence I did the following:

1) Provided access permission for the jar files 2) While I was generating entities I was giving the package name as com/domainname/ejb/testjpaprojectfacets/model. But I was already having a package com/domainname/ejb/TestJPAProjectFacets hence the error. I then renamed my existing package to all lowercase (com/domainname/ejb/testjpaprojectfacets) and it worked.

Thanks, Sanjay

like image 188
Sanjay Bharatiya Avatar answered Apr 05 '23 20:04

Sanjay Bharatiya


My workaround was to use the JTDS JDBC Driver to connect to SQL Server database instead of the Microsoft SQL Server JDBC Driver

like image 25
Slobodan Rasetic Avatar answered Apr 05 '23 22:04

Slobodan Rasetic