permaculture playing cards
The moose likes Object Relational Mapping and the fly likes Hibernate mapping oracle char Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate mapping oracle char" Watch "Hibernate mapping oracle char" New topic

Hibernate mapping oracle char

Ranch Hand

Joined: May 29, 2002
Posts: 198
Hi All,

I have db field of type char(4).
I use hibernate to get this particular field .
The type specified in hibernate file is as below

<property name="abc" type="string">
<column name="abc" length="4" />

I also tried giving sql-type=char(4).
I used createSQLQuery method of hibernate session to get this value .
But I get only the first character of the field value.
Can anybody suggest why?

Travis Hein
Ranch Hand

Joined: Jun 06, 2006
Posts: 161
does the Java bean that you map to define the property 'abc' as a java String?

The Java char primative, or java.lang.Character class still only old one character.

I found that char(s) in the datbase map to java.lang.String, or "text" types in hibernate.

Error: Keyboard not attached. Press F1 to continue.
I agree. Here's the link:
subject: Hibernate mapping oracle char
It's not a secret anymore!