-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Why does getBatcher() work but Query does not?
PostPosted: Thu Jul 24, 2008 10:23 am 
Newbie

Joined: Wed Jul 23, 2008 9:19 am
Posts: 1
Hi,

When I am trying to generate an id for my object; I have a class that implements IdentifierGenerator I get a stackOverflow when calling Query.uniqueResult(); The query is obtained from SessionImplementor which is passed into generate method which I have implemented as the interface dictates. The Query is an object returned from getNamedSQLQuery(). This operation is in the context of an update and somehow it ends up being a recursive call on itself ending in a stackOverFlow. However, if i call getBatcher() on the SessionImplementor and perform the same sql query it works fine.

Two questions I have are:

1) Why do I get a stackOverFlow?
2) What is the difference between getting this Batch object vs using the Query from the SessionImplentor?

I know or have a feeling that it has to do with session context but it is not clear.

By the way, the actual query is reading the max value from the table + 1. And yes, I know that there other generators to be used and this method is not really full proof but it is an exercise rather than an implementation i am considering in a 'real' app.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 25, 2008 3:59 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
Quote:
public class StackOverflowError
extends VirtualMachineError

Thrown when a stack overflow occurs because an application recurses too deeply.


http://java.sun.com/j2se/1.4.2/docs/api/java/lang/StackOverflowError.html

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.