hibernate - NHibernate: Lazy loading of IUserType -
Say we have a system that stores details of customers, and a system that stores employees' details (fictitious status!) Employee employees use an employee, Client Information Client system applies to IUserType using WCF:
NHibernate mapping:
& lt; Hibernate-mapping xmlns = "kalash: nibinet-mapping2.2" assembly = "employee system" namespace = "staffsystem.intext" & gt; & Lt; Class name = "employee" table = "employee`" & gt; & Lt; Id name = "id" column = "` id` "type =" tall "& gt; & Lt; Generator class = "parent" /> & Lt; / Id & gt; & Lt; Property Name = "Name" /> & Lt; Property name = "client" column = "` client id` "lazy =" true "type =" employee system user type. Client type type, employee system "/ & gt; & Lt; / Square & gt; & Lt; / Hibernate-mapping & gt; IUserType implementation:
public class ClientUserType: IUserType {... public object NullSafeGet (IDataReader rs, string [] name, object owner) {Object Obj = NHibernateUtil.Int32.NullSafeGet (RS, name [0]); IClientService Client Service = New Client Services Service (); ClientDto clientDto = Null; If (null! = Obj) {clientDto = clientService.GetClientById (Convert.ToInt64 (obj)); } Client Client = New Client {ID = Customer Dto.Id, name = clientDto.Name}; Return customer; } ...} Even if I have lazy = "truth" on the property, as soon as the client loads when the employee loads. Is this the right behavior? Do I have to implement sluggish loading in Nalasafgate or do I miss something?
Is it the same one-in-one relationship being in hibernation tells the documentation that it is all possible, Options are also displayed in the XML configuration file to lazy loads for one-to-one relationships, but they have no apparent effect.
Comments
Post a Comment