-->
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.  [ 5 posts ] 
Author Message
 Post subject: String property to Long DB field
PostPosted: Tue Mar 09, 2004 5:22 am 
Beginner
Beginner

Joined: Thu Feb 26, 2004 6:59 am
Posts: 47
Location: Gurgaon, India
Hello,

I want to map bean's string proeperty to db long column. Use case is:

We have large data as string property in a java bean. And we want to save it in a long column in database.

This can be achieved using clob type. But our existing system has support for long data type in db using JDBC, so we want to support the existing schema. This can be achieved using JDBC, by using statement.setCharacterStream, we can save string data as Long in oracle db.

But I am not getting the way to implement this using Hibernate. As I am finding no way to convert string to long, so that can map it with long type of db.

waiting for suggestion, it is urgent.

Thanks

_________________
Mohit Gupta
Software Engineer
Gurgaon, India


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 09, 2004 6:04 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Use a custom UserType. There are various examples for mapping blobs in the wiki area.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 09, 2004 6:04 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Or just use type="text" for the property.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 09, 2004 6:21 am 
Beginner
Beginner

Joined: Thu Feb 26, 2004 6:59 am
Posts: 47
Location: Gurgaon, India
Thanks Michael, but this would need clob type field in database to map this property using "text". But our requirement is that we want to maintain "Long" field in database and want to map it with String property.
Like:

<property name="definition" type="string">
<column name="definition" sql-type="long"/>
</property>

As I wrote earlier, that this can be achieved using JDBC statement interface, now need help to implement it using Hibernate.

_________________
Mohit Gupta
Software Engineer
Gurgaon, India


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 09, 2004 6:25 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
I don't get what your problem is. I think "type=text" is exactly what you should use. Otherwise, use a custom UserType, you can do pretty much anything there. Take a look at the wiki area and the sources in net.sf.hibernate.type


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.