java - Hibernate join without foreign key and map only a table -


i'm studying orm pattern , hibernate framework.

i have 2 tables: table library , table book

|library                  |  book +-------------------      +-------------- |libraryid :int (pk)      |bookid:int (pk) |name:varchar             |libraryid:int  

the column libraryid in book isn't foreign key

for join tables, use code written below

session.createquery("from book b, library l b.libraryid=l.libraryid , l.name=:name")             .setstring("name", "test" )             .list(); 

from code list of object[] of book , library class. how can book class?

session.createquery("select b book b...) should gives vales of class book.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -