Hi,
I have defined 3 tables as below:
Listing
==================
ID Description
==================
1 My book is good
--------------------------------
2 My car is for sale
--------------------------------
3 My pda is for sale
==================
Alert
==================
ID Keywords
--------------------------------
1 book
--------------------------------
2 book
--------------------------------
3 sale
--------------------------------
These 2 tables has no relationship at all. What I need to do is to find a list listing which match description with keywords from Alert table.
Therefor the query is
select l, from listing l, alert a where l.description like concat('%',a.keywords,'%')
This query is valid when I run it at the mysql command line.
but when I applied it in hibernate, it fails.
at Listing.hbm.xml and Alert.hbm.xml, all the parameters are defined.
Also, the persistence entity class for Listing and Alert are defined with it's setter and getter method as the mapping to the tables.
No relationship between these 2 tables are defined in the hbm.xml files and persistence entity class files.
I wonder is the problem because of the no relaitionship defined? If this is true, how can I the relaitionship be defined at the hbm.xml files and class files?
please guide.thank you
|