validate issue - char converted to varchar2(255) in Oracle

Description

Deployment in Tomcat I get this issue with one of my persistent object, deployment issue 'Wrong column type FGTADM.CABIN_CLASSES for column class_code. Found: char, expected: varchar2(255 char).

I think the issue is with the Oracle dialect and how it converts a java String type to varchar2(255); regardless of what is on set on the @Column annotation; in particular the columnDefinition='char' setting is ignored.

Currently the class that errors on deployment is annotated like this:
public class CabinClass extends FareGateObject {

@Id
@Column(name = "class_code", length=1, columnDefinition = "char")
private String classCode;

The Oracle cabin_class table is structured like this:
COLUMN_NAME TYPE_NAME COLUMN_SIZE
CLASS_CODE CHAR 1
CLASS_NAME VARCHAR2 15
DESCRIPTION VARCHAR2 200

Any help appreciated. Do I need to upgrade hibernate? Is the @Column annotation definition correct?

regards
geoffpowdrell

Environment

Oracle 10g, Spring 3.0.2, Hibernate 3.5.4

Activity

Show:
Brett Meyer
April 7, 2014, 5:47 PM

In an effort to clean up, in bulk, tickets that are most likely out of date, we're transitioning all ORM 3 tickets to an "Awaiting Test Case" state. Please see http://in.relation.to/Bloggers/HibernateORMJIRAPoliciesAndCleanUpTactics for more information.

If this is still a legitimate bug in ORM 4, please provide either a test case that reproduces it or enough detail (entities, mappings, snippets, etc.) to show that it still fails on 4. If nothing is received within 3 months or so, we'll be automatically closing them.

Thank you!

Brett Meyer
July 8, 2014, 3:11 PM

Bulk rejecting stale issues. If this is still a legitimate issue on ORM 4, feel free to comment and attach a test case. I'll address responses case-by-case. Thanks!

Ihor Herasymenko
October 29, 2015, 8:58 PM

Still reproducible on Hibernate 5.0.3.
The same issue on MySQL and HSQL. The Testcase is attached.
https://dl.dropboxusercontent.com/u/61751342/hibernate-char-varchar-mapping-bug.zip

Ihor Herasymenko
October 29, 2015, 9:00 PM

@brmeyer please take a look to my comment above.

Brett Meyer
November 2, 2015, 3:37 PM

Thanks for the response! However, this is a duplicate of HHH-9853, which is more generalized. Keep an eye on that one!

Rejected

Assignee

Unassigned

Reporter

Geoff Powdrell

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

Priority

Major