Between ObjectA and ObjectB there is a One-One relationship, which is configured as LAZY.
| @OneToOne(mappedBy="objectA",fetch=FetchType.LAZY,cascade={CascadeType.MERGE,CascadeType.PERSIST}) @org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.ALL,org.hibernate.annotations.CascadeType.DELETE_ORPHAN } ) | public ObjectB getB() | { | return b; | } | When I load / find ObjectA via this finder method | public ObjectA findA(int id) | { | logger.info("Find A by id"); | ObjectA objectA = manager.find(ObjectA.class, id); | return objectA; | } | I can see the following output in the log file: anonymous wrote : | 10:25:51,718 INFO [ServiceProviderBean] Find A by id | 10:25:51,718 INFO [STDOUT] Hibernate: select objecta0_.id as id141_0_, objecta0_.name as name141_0_, objecta0_.version as version141_0_ from ObjectA objecta0_ where objecta0_.id=? | 10:25:51,718 INFO [STDOUT] Hibernate: select objectb0_.id as id142_0_, objectb0_.name as name142_0_, objectb0_.version as version142_0_, objectb0_.imagedata as imagedata142_0_, objectb0_.objectA_id as objectA5_142_0_ from ObjectB objectb0_ where objectb0_.objectA_id=? | 10:25:51,750 INFO [ObjectB] Post Load | 10:25:51,750 INFO [STDOUT] Hibernate: select objectc0_.id as id143_0_, objectc0_.name as name143_0_, objectc0_.version as version143_0_, objectc0_.imagedata as imagedata143_0_, objectc0_.objectA_id as objectA5_143_0_ from ObjectC objectc0_ where objectc0_.objectA_id=? | 10:25:51,765 INFO [ObjectC] Post Load | 10:25:51,765 INFO [ObjectA] Post Load | Even though the relationship is configured as LAZY it seems that the related objects are loaded. In this case as ObjectB contains a BLOB this is a very expensive operation. I understand that the specifications specify a default EAGER mapping for a One-One relationship, but there should be the option to make it LAZY. Yes I know that I previously complained about the same thing on One-Many relationships. http://jboss.org/index.html?module=bb&op=viewtopic&t=80437 That was a mistake, I had the relationship wrong. It should have been a One-One rather then a One-Many.[/url] View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3936204#3936204 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3936204 ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user