daveayan wrote:
Hello,
I have this weird requirement where I may need to use table name in hql. 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
yes