i have a query that gets the user who have a specific book in their bookshelf but im not sure i understand why this takes place every time i load a user.... could someone explain why?
Hibernate: select user0_.user_id as user_id,.......
Hibernate: select booklines0_.user_id ....
Hibernate: delete from BOOK_LINES where user_id=? and isbn=? and date=? and available=?
Hibernate: insert into BOOK_LINES (user_id, isbn, date, available) values (?, ?, ?, ?)
the query
session.find("select u from User u inner join u.bookshelf.booklines bl inner join bl.book b where b.isbn='"+isbn+"'");
Hibernate version:latest
Mapping documents: <hibernate-mapping package="dk.bytenbog.model.businessobject"> <class name="User" table="USER">
<id name="username" type="string" column="user_id"> <generator class="assigned"/> </id>
<property name="password" type="string" column="password"/> .... ....
<component name="bookshelf" class="Bookshelf">
<set name="booklines" table="BOOK_LINES" cascade="all" lazy="true"> <key column="user_id"/>
<composite-element class="Bookline"> <many-to-one name="book" class="Book"> <column name="isbn"/> </many-to-one>
<property name="date" type="date" column="date"/> ....
</composite-element> </set>
</component> </class>
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
|