This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 219805 - Can not generate entity class from database
Summary: Can not generate entity class from database
Status: REOPENED
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 8.2
Hardware: PC Windows 7
: P2 normal with 1 vote (vote)
Assignee: Sergey Petrov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-10 10:03 UTC by dzungdev
Modified: 2017-07-13 19:31 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
It is screenshort for netbean 7.2 when I tried to generate entity class from database (23.63 KB, image/png)
2012-10-10 10:03 UTC, dzungdev
Details
This is source code for qms enterprise application (45.50 KB, application/octet-stream)
2012-10-10 11:54 UTC, dzungdev
Details
backup of database for postgres sql 9.1 (2.80 MB, application/octet-stream)
2012-10-18 01:43 UTC, dzungdev
Details
Cannot be added becaused it is already mapped to the entity class and the entity is not in current project source (143.49 KB, image/jpeg)
2017-07-13 19:19 UTC, vinh_truong
Details

Note You need to log in before you can comment on or make changes to this bug.
Description dzungdev 2012-10-10 10:03:40 UTC
Created attachment 125668 [details]
It is screenshort for netbean 7.2 when I tried to generate entity class from database

My step is:

1. Create Java Enterprise Application: qms
2. Create "Entity Class from database" in qms-ejb project
3. I want to generate entity for table: ph_dis_queue but it showed that: "ph_dis_queue cannot be added because it is already mapped to the my.com.cmg.qms.model.DisQueue entity class and the entity is not in current project source."

I don't have any DisQueue entity class in NetBean project.
Comment 1 Sergey Petrov 2012-10-10 10:13:16 UTC
my.com.cmg.qms.model.DisQueue seems quite complex to be some random bug in the NB, do you have fresh entterprise application without any sources and any dependencies?
Comment 2 dzungdev 2012-10-10 11:54:07 UTC
Created attachment 125680 [details]
This is source code for qms enterprise application
Comment 3 Sergey Petrov 2012-10-16 10:04:15 UTC
I don't have the same database and can't emulate completely, but if add persistence.xml into qms-ejb and try to add entities, no entities are found.
In this case ide don't see any entities, the only possible in theory issue may be specific to some table types, can you provide sql script/db schema?
Comment 4 Sergey Petrov 2012-10-17 14:35:01 UTC
please reopen with information requested above, also message.log may help, but if will not help I'll need to add some logging.
Comment 5 dzungdev 2012-10-18 01:43:54 UTC
Created attachment 126119 [details]
backup of database for postgres sql 9.1

Dear Sergey,

I am sorry for answering late. 

I attached here the backup of postgres sql 9.1. You just create new empty database and restore with the backup file which I attach here. Then you will have all table to try to reproduce the bug.

I hope it can help you.

Best Regards,
Dzung
Comment 6 stephane.russell 2013-02-09 22:51:54 UTC
I had a similar problem after updating NetBeans from 7.1.2 to 7.2.1. I couldn't regenerate my Entity Beans from a database. I got a similar error message (<table> cannot be added because it is already mapped to the...)

I delete the directory AppData\Local\NetBeans\Cache\7.2.1 and restarted NetBeans and the problem was solved.
Comment 7 dazzolo 2013-05-11 15:50:46 UTC
I have the same problem with netbeans 7.3, but i can't resolve deleting Cache folder... any suggestions?? Thanks.
Comment 8 Sergey Petrov 2013-08-07 13:12:48 UTC
Sorry for late response, unfortunately it seems to be some scanning issue, as  sometimes can be resolved by cache deletion.
Regarding the case if cache deletion can't help, it may be another issue and it's nuce to provide all required details, like attach a project sample if possibke, db script, also did you remove proper cache folder etcn. If it still worth, please reopen the issue with some details. Also message.log may help.
Comment 9 thufir 2014-10-10 11:11:37 UTC
I'm on 8.01 and have this exact problem.  I'm looking for message.log, there doesn't seem to be a var directory in netbeans.  I just created a brand new Enterprise Application, which I can attach, but there's nothing there -- it's brand new.
Comment 10 Sergey Petrov 2014-10-10 12:25:02 UTC
You can find cache directory location with Help|About dialog.
Comment 11 Sergey Petrov 2014-10-14 08:42:34 UTC
I see you have asked how to remove cache in jee mailing list, were you able to resolve the issue by cache cleaning?
Comment 12 Martin Balin 2016-07-07 08:53:19 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss
Comment 13 vinh_truong 2017-07-13 19:19:56 UTC
Created attachment 164762 [details]
Cannot be added becaused it is already mapped to the entity class and the entity is not in current project source
Comment 14 vinh_truong 2017-07-13 19:20:27 UTC
I have same problem in 8.2
Comment 15 vinh_truong 2017-07-13 19:31:22 UTC
Temporary solution is:

Delete the cache folder in the following
C:\Users\yourusername\AppData\Local\NetBeans\Cache