I have two related entities, say
@Entity
public class Book {
@ManyToOne
Shelf shelf;
}
@Entity
public class Shelf {
@OneToMany(mappedBy="shelf")
Set<Book> books;
}
If I fetch an empty shelf (no books), create and persist a new book to the shelf and then fetch that shelf again, its books collection is empty. When I run...
Good day,
What if I have a query that gets called multiple times in a single thread, and I just want to cache that query (and its result) for that thread (or for that session since I'm using one session per thread), how can I do that ?
Note: My 2nd level cache is turned on but it's used mostly for session.get(...). But I do not want to...
I have the following definitions for the Animal and Dog types. Note that the ID for the object is the AnimalID:
<class name="Animal" table="Animals">
<id name="Id" type="System.Int32" column="AnimalID">
<generator class="identity" />
</id>
<property name="IsBig" column="IsBig" type="System.Bool" not-null="true" />
...
Related to this question
Premise:
These are my assumptions, based on my reading, experience and understanding, they may be wrong, if they are, please comment and I'll edit the question.
Query cache is good mostly along with 2nd level cache
Query cache caches the identifiers results of queries + parameters
Query cache is risky if the...