Scott Swank wrote:
> 
> If you have lazy-loaded objects in your graph then they are initially
> populated with Hibernate proxies and only resolved from the database
> when you access them in your application code.  I imagine that in one
> case the Hibernate transaction is being closed before you have walked
> the object graph far enough to retrieve all of the relevant objects,
> while in the other case the transaction is still open and so Hibernate
> can resolve the proxies.
> 
> Try looking at any relevant settings on the jdbc drivers.  We're using
> jtds successfully (to the degree that anyone uses sql server
> successfully).
> 
> Scott
> 


Yeah, I thought of that, but given the following code, you'll see that that
isn't the case.  Yet, the load() statement fails in my scenario.  I made a
very simple Parent and Child class test that doesn't suffer from this
problem.  But, my complex objects do.  My guess is that I have a "bad"
mapping, but my REAL concern is that with one driver it works and the other
it doesn't!

SpecChangeModelObject result;
Session sess = hibernateSessionFactory.openSession();

Criteria criteria = sess.createCriteria(SpecChangeModelObject.class);
criteria.add(Restrictions.idEq("{8D6A620D-B094-46CB-A6E7-34B4CE99EECD}"));
result = (SpecChangeModelObject) criteria.uniqueResult();
assertNotNull("SpecChangeModelObject should not be null", result);
assertNotNull("ResponsibleIndividuals should not be null",
result.getResponsibleIndividuals());
assertFalse("ResponsibleIndividuals.isEmpty failed",
result.getResponsibleIndividuals().isEmpty());
assertEquals("ResponsibleIndividuals.size failed", 2,
result.getResponsibleIndividuals().size());


result = (SpecChangeModelObject) sess.load(SpecChangeModelObject.class,
"{8D6A620D-B094-46CB-A6E7-34B4CE99EECD}");
assertNotNull("SpecChangeModelObject should not be null", result);
// will fail on the next line!
assertNotNull("ResponsibleIndividuals should not be null",
result.getResponsibleIndividuals());
assertFalse("ResponsibleIndividuals.isEmpty failed",
result.getResponsibleIndividuals().isEmpty());
assertEquals("ResponsibleIndividuals.size failed", 2,
result.getResponsibleIndividuals().size());

sess.close();

Chuck
-- 
View this message in context: 
http://www.nabble.com/Frustracted-with-JDBC...-tf3375802.html#a9399084
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to