-->
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.  [ 3 posts ] 
Author Message
 Post subject: How to map column of Oracle's type ROWID?
PostPosted: Mon May 30, 2005 11:34 am 
Newbie

Joined: Mon May 30, 2005 11:22 am
Posts: 2
One of my tables has a column of type ROWID in my Oracle database. If I omit mapping this column, I can get result list, however, iterating the list to retrieve list elements throws NullPointException - all elements are null. If I map the column as type="rowid", and in my JavaBean I use Long type for this field, I get Hibernate Configuration Error - "Could not determine type for: rowid, for columns: [org.hibernate.mapping.Column(SEQUENCE_NUM)]". I am using Hibernate3.

Anybody has experience of mapping ROWID columns? Any help is greatly appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 03, 2005 3:56 pm 
Regular
Regular

Joined: Mon Jul 26, 2004 2:28 pm
Posts: 86
Location: Pensacola, Florida
A ROWID in Oracle is actually a logical address for a row. Every ROWID is unique; it is not merely the offset of a row within a table (unlike ROWNUM). You can't really cast it to a numeric type--it's more complex than that.

What you probably need to do is implement a org.hibernate.usertype.UserType class that uses Oracle-specific calls to extract the ROWID and return it as a special object type (oracle.sql.ROWID). Set your property to be that type and then set the <property> type to be your UserType implementation in the Hibernate mapping file.

That, or just maybe mapping it as type Object and casting as necessary in your code might work....

- Jesse


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 03, 2005 6:28 pm 
Newbie

Joined: Mon May 30, 2005 11:22 am
Posts: 2
Thank you Jesse for your reply.

I have figured out that if I treat ROWID same as VARCHAR2 and map to string, then everything works fine.


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