Hi, I like hibernate much (i just love it),
it speed up my development process,
but I i've problems with performance, I've enabled second-level
cache, but i've one problem:
does Hibernate second-level cache support maps?
this is part of my project (hbm.xml)
(should) represent a simple parent-child relation
Code:
<hibernate-mapping>
<class name="N" table="N" lazy="true" >
<cache usage="read-write" />
<id name="id" column="ID">
<generator class="native" />
</id>
...
<map name="children" table="NC" cascade="all" lazy="extra">
<cache usage="read-write" />
<key column="N_ID" />
<map-key column="KEY" type="char" />
<one-to-many class="N" />
</map>
</class>
</hibernate-mapping>
I've few questions about it:
Hibernate 3.1 created such table
Code:
TABLE N (ID, N_ID, KEY)
after turning on caching any configuring project according to provided samples - hibernate seems to enable caching for N, but not for map
- a many queries (SELECT ID FROM N WHERE N_ID=? AND KEY=?) seem to slow down application.
I've similar problems with other maps in my application.
Quote:
1)
So my question is - does Hibernate support caching maps? Is it dependent of cache implemetation?
2)
Quote:
Second question is quite pragmatic - how to keep map implemetation in a separate table? At this point hibernate doesn't put relation in a separate table, but in a parent's table (N).
Code:
TABLE N(ID)
TABLE NC(ID,N_PARENT,N_CHILD,N_KEY)
3)
Quote:
Third question - is there more effective model or Tree than provided above?
4)
Quote:
Last question - how long does Hibernate cache objects? Is lifetime of objects in cache is dependent of transaction or session?
I would apreciate any help with these problems,
Thank you,
Dominik