-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: How to query a composite key class
PostPosted: Sun Jul 24, 2005 10:16 pm 
Newbie

Joined: Thu Jul 21, 2005 10:25 pm
Posts: 4
I'm using myeclipse to develop my system.

I have a table named Tapplicationproject in my database.

When I generated the hibernate mapping using myeclipse, The following files were created:

- AbstractTapplicationproject.java
properties that I need (all are accessible from Tapplicationproject.java):
- description
- endDate
- id
- location
- role
- startDate
- tools

- Tapplicationproject.java
properties that I need: (NONE) but I'm using this class to access all fields because this is the child class of AbstractTapplicationproject.java

- TapplicationprojectKey.java
properties that I DESPERATELY need:
- applicationId
- projectName

- Tapplicationproject.hbm.xml

Now, I need to get ALL fields from Tapplicationproject table.

The problem is, the composite primary keys ('applicationId' & 'projectName' properties) are stored ONLY in the TapplicationprojectKey.java and I cannot query this class.

When I tried to query TapplicationprojectKey.java, the compiler said that TapplicationprojectKey is not a persistent class. So I have no idea how to query the 'applicationId' & 'projectName' from the TapplicationprojectKey using the HQL query.

Anyone know the way to work around this?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 25, 2005 9:22 am 
Newbie

Joined: Tue Jun 28, 2005 11:11 am
Posts: 13
Location: St. Louis, Missouri, USA
In your finder methods "from BlahObject p where p.primarykey.somefield = ?"

Where "primarykey" is what I called my primarykey object in my BlahObject class. I've composite examples posted on this forum, search by my username for more code and xml.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


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

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.