Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

@NamedQuery join tables

803165Dec 3 2010 — edited Dec 6 2010
I have 3 entities in JPA layer, "Project", "WorkTask" and "Amount"
Their names in the database , which is oracle, is "Projects", "Work_Tasks" and "Amounts"
Im using Rational with eclipse.
Here is the Namedquery in WorkTask entity
All the Table names and attribute names are the names in entity language.
I have tried changing all the names to the names in the database, beside the WorkTask entity names, but still didnt work.
Can anyone see the problem?
	@NamedQuery(name= "findUnassignedWorkTasks", 
				query="SELECT w from WorkTask w, Project p WHERE w.pId.tId = p.tId " +
					  "AND p.ownerId.uId = 4 AND w.wtYear > 2010 AND w.wtWeek > 1 AND w.workHoursTotal > " +
					  "(SELECT SUM(a.workHours) FROM Amount a, WorkTask ww, Project pp " +
					  "WHERE ww.tId = a.tId.tId AND ww.pId.tId = pp.tId AND pp.ownerId.uId = 4 AND a.accepted = 'T')")
This query dont return anything. Is there any reason

Edited by: LegendiN on 2010-12-03 13:42                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 3 2011
Added on Dec 3 2010
3 comments
678 views