This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Hibernate mapping oracle char Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "Hibernate mapping oracle char" Watch "Hibernate mapping oracle char" New topic
Author

Hibernate mapping oracle char

Ajai
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" />
</property>


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?

Thanks
Ajai
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: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Hibernate mapping oracle char
 
Similar Threads
how to insert
update
JOIN syntax for HQL . Need help!
Mapping Problem in Hibernate
Hibernate insert or select gives "Identifier of an instance altered"