-->
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.  [ 34 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject:
PostPosted: Mon Sep 20, 2004 9:19 am 
Senior
Senior

Joined: Sun Jan 04, 2004 2:46 pm
Posts: 147
This easiest way is to specify

Code:
hibernate.connection.defaultNChar true


in your hibernate properties file. This will cause ALL string parameters to be treated as unicode. This might be 10g only tho ( not sure ) and you'll need the latest JDBC drivers from the oracle website.

Using DBCP you can unwrap the prepared statement by doing.

Code:
//                DelegatingPreparedStatement ps = (DelegatingPreparedStatement)preparedStatement;
//                OraclePreparedStatement ops = (OraclePreparedStatement)ps.getInnermostDelegate();


and then the setFormOfUse thing. C3P0 I don't think this is possible ( cast to NewProxyPreparedStatement OK, but theres no public getter for the inner PreparedStatement ). Proxool I didn't try.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 20, 2004 9:30 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
With Proxool you should be able to just cast to OraclePreparedStatement AFAIK


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 20, 2004 10:03 am 
Proxool Developer
Proxool Developer

Joined: Tue Aug 26, 2003 10:42 am
Posts: 373
Location: Belgium
michael wrote:
With Proxool you should be able to just cast to OraclePreparedStatement AFAIK


The version of Proxool supporting this feature is not yet released - please grab a copy from CVS in the meantime.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 20, 2004 11:13 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Thanks Bertrand, proxool guru :) Thats a nice feature by the way, I really wonder why not more pools are supporting this - with the wide spread of dynamic proxies/cglib now have.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 20, 2004 11:13 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Ah, english grammar no good :)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 21, 2004 3:29 am 
Proxool Developer
Proxool Developer

Joined: Tue Aug 26, 2003 10:42 am
Posts: 373
Location: Belgium
michael wrote:
Thanks Bertrand, proxool guru :) Thats a nice feature by the way, I really wonder why not more pools are supporting this - with the wide spread of dynamic proxies/cglib now have.


Yes indeed... unfortunately, this feature is in 'early beta' for now and hasn't been intensively tested yet (no more free time to work on the project :(


Top
 Profile  
 
 Post subject: Testing Oracle 9i + 10g
PostPosted: Tue Sep 21, 2004 2:39 pm 
Newbie

Joined: Fri Mar 26, 2004 8:44 am
Posts: 10
I'll test this using Oracle 9i and Oracle 10g and let you know.

BTW - this workaround is only necessary if the database character set is NOT UTF8(16) (if it is UTF8, nvarchar and varchar are effectively the same).

If the Oracle database is non-UTF8, setFormOfUse is necessary for any correct updates using Unicode-Characters.

johannes


Top
 Profile  
 
 Post subject: Re: Testing Oracle 9i + 10g
PostPosted: Tue Sep 21, 2004 3:27 pm 
Proxool Developer
Proxool Developer

Joined: Tue Aug 26, 2003 10:42 am
Posts: 373
Location: Belgium
joe_the_quick wrote:
I'll test this using Oracle 9i and Oracle 10g and let you know.


Make sure you are using oracle.jdbc.OracleDriver and not the old *deprecated* oracle.jdbc.driver.OracleDriver (as exlained in the Oracle release notes).

This new version of the jdbc driver is made of interfaces instead of concrete classes (as the old one) - making it possible for Proxool to implement them as well...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 21, 2004 3:28 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Again, you have to applaud Oracle for the choice of names. Well done... not.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 21, 2004 4:04 pm 
Proxool Developer
Proxool Developer

Joined: Tue Aug 26, 2003 10:42 am
Posts: 373
Location: Belgium
christian wrote:
Again, you have to applaud Oracle for the choice of names. Well done... not.


Indeed...
To be honest, I'm quite new to Oracle and I'm very disapointed by their JDBC driver (and their support!).

We already spent lots of hours tracking bugs in our applications, thinking we made a mistake somewhere... We never thought it could be a problem in the JDBC driver... Now it's becoming the first thing we look at :(


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 22, 2004 4:52 am 
Senior
Senior

Joined: Sun Jan 04, 2004 2:46 pm
Posts: 147
Would it be possible to post a quick list of the bugs you've found in the driver? I've just started working with Oracle so it would be very useful for me and probably others. :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 22, 2004 12:38 pm 
Proxool Developer
Proxool Developer

Joined: Tue Aug 26, 2003 10:42 am
Posts: 373
Location: Belgium
Don't remember them all, but I'm pretty sure you can ask Google for more info ;)

From what I remember:

- problems with types read from the ResultSet using a Stream (BLOB's, and other large types like the byte[] - maybe others): they must be fetch the latest otherwise the resultset complains with a 'stream closed' exception. This means these types cannot be used in conjunction with a 'join fetch';

- fields must be retrieved in the order they appear in the select clause (not sure it is still applicable for the very latest versions);

- this one is not a bug but a feature (very annoying feature): empty strings are replaced by NULL values. Very confusing when you persist your classes with an empty string and you get it back with a null value. Even more annoying when you need to make the distinction between null and empty - which ARE two different things;

That's all I remember from now... maybe we should add some wiki pages with the known issues with regards databases (not sure Gavin wants to turn his site into an Oracle bug tracking though ;)


Top
 Profile  
 
 Post subject: Getting Wrapped Statement in Weblogic 8.1 SP5
PostPosted: Wed Sep 20, 2006 4:13 am 
Newbie

Joined: Wed Sep 20, 2006 4:09 am
Posts: 1
If you are using weblogic you can retrieve the actuall connection from the proxy like this. It is not very nice but it seems to work.

Code:
  Field declaredField = ps.getClass().getField("vendorObj");
  OraclePreparedStatement preparedStatement = (OraclePreparedStatement) declaredField.get(ps);
  preparedStatement.setFormOfUse(1, OraclePreparedStatement.FORM_NCHAR);


Not sure if this helps.[/code]


Top
 Profile  
 
 Post subject: similar problem
PostPosted: Mon Nov 26, 2007 10:50 am 
Newbie

Joined: Mon Nov 26, 2007 10:37 am
Posts: 2
i have similar problem.
I have 6 oracle 9.2 databases and on 4 of them the system works nice.
I want to store xml inside xml and it does so. But those 2 broken DB put some rubish characters inside.
When i use regular jdbc it works good. I do not know what the problem might be.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 11, 2008 4:13 pm 
Newbie

Joined: Tue Mar 11, 2008 3:58 pm
Posts: 1
Since neither of setting the defaultNChar or setFormOfUse is an option for me, I'm converting the data into a string of Unicode hex notations ('\xxxx') and insert it into the nvarchar2 column using the SQL unistr(hex notations).

I'm wondering if there is a setting in Hibernate to generate the unistr() SQL automatically for a property.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 34 posts ]  Go to page Previous  1, 2, 3  Next

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.