-->
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.  [ 1 post ] 
Author Message
 Post subject: Table name in HQL
PostPosted: Fri Dec 12, 2008 3:10 pm 
Newbie

Joined: Fri Dec 12, 2008 3:03 pm
Posts: 3
Hello,

I have this weird requirement where I may need to use table name in hwl. Is this possible or is there any work around?

Specifics:
3 Tables:
CREATE TABLE PERSON (
person_id int,
user_id varchar(32),
first_name varchar(128),
last_name varchar(128)
);

CREATE TABLE ADDRESS (
address_id int,
unit_no varchar(8),
addressLine1 varchar(128),
city varchar(64)
);

CREATE TABLE PERSON_ADDRESS_LINK (
person_address_link int,
person_id int,
address_id int
);

- I have created Person.java and Address.java
- I CANNOT create PersonAddressLink.java
- A person can have multiple addresses but I DO NOT have a Set of addresses in Person.java.
- I have PersonDao and AddressDao
- I want to write a method in AddressDao public List<Address> findByPersonId(Person person) {}
- The query within this method should use PERSON_ADDRESS_LINK and return a list of addresses.

Is this possible?

Thanks
Ayan


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

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.