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.  [ 1 post ] 
Author Message
 Post subject: Getting query kind on custom UserType
PostPosted: Mon Dec 03, 2007 5:19 am 
Newbie

Joined: Fri Jan 12, 2007 12:25 pm
Posts: 6
Hibernate version: 3.2.0ga

Hi everyone!
I'm sorry, I have a custom UserType that maps to a varchar, with a nullSafeSet like this:

Code:
public void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
   Object val = null;
   if(st.getMetaData()==null){
      // so this is a Insert or Update, I must generate the value automatically
      val=... // complex business rule
   }
   else{
      // this is a Select, just pass the value on
      val=value;
   }
   
   Hibernate.STRING.set(st, val, index);
}


The objective is to generate the value automatically on insert, based on some complex business rule.. Everything works fine with MySQL and PostgreSQL, but with Oracle I get a "statement handle not executed" exception on getMetaData() (using ojdbc14.jar, version 10.2.0.3.0)..
Is there another way to find out if nullSafeSet is called on "insert" or on "select"?
Many thanks for your time!


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

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.