[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3100) Hibernate Fails on More Than One VARCHAR2(4000) Property

James Carman (JIRA) noreply at atlassian.com
Fri Feb 8 12:59:32 EST 2008


Hibernate Fails on More Than One VARCHAR2(4000) Property
--------------------------------------------------------

                 Key: HHH-3100
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3100
             Project: Hibernate3
          Issue Type: Bug
          Components: core
    Affects Versions: 3.2.5
         Environment: Java Version:
java version "1.5.0_14"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
Java HotSpot(TM) Client VM (build 1.5.0_14-b03, mixed mode, sharing)

Hibernate Version:
3.2.5.ga

Oracle Database Version:
Oracle, version: Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production

Oracle Driver Version:
Oracle JDBC driver, version: 10.2.0.3.0
            Reporter: James Carman


If I have more than one long string (mapped to a varchar2(4000) column) within my entity class, Hibernate fails with:

"java.sql.BatchUpdateException: ORA-01461: can bind a LONG value only for insert into a LONG column"

My class looks like (Entity is a superclass that defines the id, equals, hashCode):

public class TwoString extends Entity {
    private String string1;
    private String string2;

    public TwoString() {
    }

    public TwoString( String string1, String string2 ) {
        this.string1 = string1;
        this.string2 = string2;
    }
    // Getters and setters here...
}

My mapping document looks like:

<hibernate-mapping>
    <class name="com.carmanconsulting.hibernate.bug.TwoString" table="HHH_BUG_TWO_STRING">
        <id name="id">
            <generator class="assigned" />
        </id>
        <property name="string1" length="4000" />
        <property name="string2" length="4000" />
    </class>
</hibernate-mapping>

My code looks like:

Configuration cfg = new Configuration();
SessionFactory sf = cfg.configure().buildSessionFactory();
Session s = sf.openSession();
try {
    Transaction tx = s.beginTransaction();
    s.save(new TwoString(repeat('Y', 3999), repeat('Z', 3999)));
    tx.commit();
}
finally {
    s.close();
    sf.close();
}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list