fetching-strategy

SetFetchMode call ignored

微笑、不失礼 提交于 2019-11-30 09:24:54
问题 I have a problem with SetFetchMode call in Criteria API in following query: DetachedCriteria.For<User>() .Add<User>(u => u.Status == UserStatus.Live) .CreateAlias("UniqueId", "uid") .CreateAlias("Companies", "comp") .Add(Restrictions.Disjunction() .Add(Restrictions.Like("uid.Uid", context.Text, MatchMode.Anywhere)) .Add(Restrictions.Like("comp.Name", context.Text, MatchMode.Anywhere))) .SetFetchMode("Companies", FetchMode.Eager)); My Classes: public class User : EntityBase<int> { public

SetFetchMode call ignored

人盡茶涼 提交于 2019-11-29 15:28:15
I have a problem with SetFetchMode call in Criteria API in following query: DetachedCriteria.For<User>() .Add<User>(u => u.Status == UserStatus.Live) .CreateAlias("UniqueId", "uid") .CreateAlias("Companies", "comp") .Add(Restrictions.Disjunction() .Add(Restrictions.Like("uid.Uid", context.Text, MatchMode.Anywhere)) .Add(Restrictions.Like("comp.Name", context.Text, MatchMode.Anywhere))) .SetFetchMode("Companies", FetchMode.Eager)); My Classes: public class User : EntityBase<int> { public virtual UniqueId UniqueId { get; set; } public virtual ISet<Company> Companies { get; set; } } public class

How does Hibernate's batch-fetching algorithm work?

我只是一个虾纸丫 提交于 2019-11-29 04:26:32
I found this description of the batch-fetching algorithm in "Manning - Java Persistence with Hibernate": What is the real batch-fetching algorithm? (...) Imagine a batch size of 20 and a total number of 119 uninitialized proxies that have to be loaded in batches. At startup time, Hibernate reads the mapping metadata and creates 11 batch loaders internally. Each loader knows how many proxies it can initialize: 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1. The goal is to minimize the memory consumption for loader creation and to create enough loaders that every possible batch fetch can be produced. Another

NHibernate Eager Fetching Over Multiple Levels

不问归期 提交于 2019-11-28 16:44:38
I have a 3-leveled hierarchy of entities: Customer-Order-Line, which I would like to retrieve in entirety for a given customer, using ISession.Get(id). I have the following XML fragments: customer.hbm.xml: <bag name="Orders" cascade="all-delete-orphan" inverse="false" fetch="join"> <key column="CustomerID" /> <one-to-many class="Order" /> </bag> order.hbm.xml: <bag name="Lines" cascade="all-delete-orphan" inverse="false" fetch="join"> <key column="OrderID" /> <one-to-many class="Line" /> </bag> I have used the fetch="join" attribute to indicate that I want to fetch the child entities for each

Is there a way to change the JPA fetch type on a method?

余生长醉 提交于 2019-11-28 08:19:22
Is there a way to change the JPA fetch type on a single method without editing the entity object? I have a shared ORM layer consisting of JPA entity classes. This ORM layer is accessed by two DAO layers. One DAO needs lazy fetching, as it is for my web application, the other needs eager fetching, as I need it to be threadsafe. Here is an example method from my threadsafe DAO, @PersistenceContext(unitName = "PersistenceUnit", type = PersistenceContextType.TRANSACTION) private EntityManager em; public ErrorCode findErrorCodeById(short id) { return (ErrorCode) em.createNamedQuery("ErrorCode

How does Hibernate's batch-fetching algorithm work?

◇◆丶佛笑我妖孽 提交于 2019-11-27 18:27:23
问题 I found this description of the batch-fetching algorithm in "Manning - Java Persistence with Hibernate": What is the real batch-fetching algorithm? (...) Imagine a batch size of 20 and a total number of 119 uninitialized proxies that have to be loaded in batches. At startup time, Hibernate reads the mapping metadata and creates 11 batch loaders internally. Each loader knows how many proxies it can initialize: 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1. The goal is to minimize the memory consumption

Is there a way to change the JPA fetch type on a method?

夙愿已清 提交于 2019-11-27 02:14:52
问题 Is there a way to change the JPA fetch type on a single method without editing the entity object? I have a shared ORM layer consisting of JPA entity classes. This ORM layer is accessed by two DAO layers. One DAO needs lazy fetching, as it is for my web application, the other needs eager fetching, as I need it to be threadsafe. Here is an example method from my threadsafe DAO, @PersistenceContext(unitName = "PersistenceUnit", type = PersistenceContextType.TRANSACTION) private EntityManager em;