NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

problem with entity classes

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
anaq



Joined: 21 Sep 2009
Posts: 44

PostPosted: Wed Oct 07, 2009 3:14 pm    Post subject: problem with entity classes Reply with quote

Hi all,

I have a problem with the entity classes in my ejb project. My situation : I have database with some tables. So I've created entity classes using netbeans wizard. My problem is, that I can get data only from one table!

Examples:
This returns records from database correctly
Code:

List<Client> clients = em.createNamedQuery("Client.findAll").getResultList();


This returns only empty list, but there are records
Code:

List<User> users = em.createNamedQuery("User.findAll").getResultList();


I've tried to add new tabels to the database, but I can not get any data from them, only empty lists. The only table, which returns data, is Client.

There is one more thing. When I look in project node -> Configuration Files -> ejb.dbschema, I find only two tables - Client and User, but there are four tables in the database.

I've tried to delete all entity classes and add them once again. The result was the same - I can get data only from one table.

I'm using Netbeans 6.7.1, MySQL database.

Any idea what to do or how to debug this?

Thank you for any help.

Michal
Back to top
Futaleufu_John
Posted via mailing list.





PostPosted: Wed Oct 07, 2009 6:26 pm    Post subject: problem with entity classes Reply with quote

Have you tried to recapture the schema from the database? To do that,
right-click on the dbschema file and select Recapture Schema from Database.

Also, take a second look a the findAll query that returns an empty list to
make sure it's correct.


anaq wrote:
Quote:

I have a problem with the entity classes in my ejb project. My situation :
I have database with some tables. So I've created entity classes using
netbeans wizard. My problem is, that I can get data only from one table!

I've tried to add new tabels to the database, but I can get any data from
them, only empty lists. The only table, which returns data, is Client.

There is one more thing. When I look in project node -> Configuration
Files -> ejb.dbschema, I find only two tables - Client and User, but there
are four tables in the database.



-----
Any ads or links to ads that appear in this post are not endorsed nor
recommended by this poster.
--
View this message in context: http://www.nabble.com/problem-with-entity-classes-tp25788907p25791662.html
Sent from the Netbeans - J2EE mailing list archive at Nabble.com.
Back to top
anaq



Joined: 21 Sep 2009
Posts: 44

PostPosted: Thu Oct 08, 2009 10:40 am    Post subject: Re: Reply with quote

Thank you for reply.

All my attempts failed, so I created everything once again - new database, new project and now it works. I don't know, where was the problem, hopefull it will not return.

Michal
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo