简体   繁体   中英

in Hibernet 1 to many mapping done by using join column how write HQL query to create inner join using that join column

I have a table 1 Tb_FileMaster with the fields (file_id file_name, file_path)

file_id is join column attribute in other table

How can I select records associated with MAX file_id selected from second table

In HQL it would look something like this:

select secondTable.* FROM Tb_FileDetails secondTable
join secondTable.tb_FileMaster firstTable
where firstTable.file_id = (select max(x.file_id) from Tb_FileMaster x)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM