Subject | Hibernate text type |
---|---|
Author | rockxwre |
Post date | 2005-01-31T13:02:17Z |
Hi,
I'm using Hibernate to access a Firebird database. This database
contains the following table:
RECREATE TABLE EMAIL
(
E_ID INTEGER NOT NULL,
...
E_BODY BLOB SUB_TYPE 1 SEGMENT SIZE 4096,
CONSTRAINT PK_EMAIL PRIMARY KEY (E_ID)
);
I created a class Email with a property "body" like this:
/**
* @...
* column="E_BODY"
* type="text"
* @return Body of the email
*/
public String getBody() {
return body;
}
As you can see the Hibernate mapping contains the type "text".
When I try to load an Email object I get the following stacktrace:
java.lang.NullPointerException: charsetName
at java.io.InputStreamReader.<init>
(InputStreamReader.java:82)
at org.firebirdsql.jdbc.field.TranslatingReader.<init>
(TranslatingReader.java:79)
at org.firebirdsql.jdbc.field.TranslatingReader.getInstance
(TranslatingReader.java:54)
at org.firebirdsql.jdbc.field.FBField.getCharacterStream
(FBField.java:603)
at org.firebirdsql.jdbc.FBResultSet.getCharacterStream
(FBResultSet.java:754)
at
org.apache.commons.dbcp.DelegatingResultSet.getCharacterStream
(DelegatingResultSet.java:298)
at net.sf.hibernate.type.TextType.get(TextType.java:29)
at net.sf.hibernate.type.NullableType.nullSafeGet
(NullableType.java:62)
...
To avoid this I can change the Hibernate property type to "string".
However, some other database systems will need this type.
Does anybody know how I can solve this?
I'm using the latest Jaybird driver.
Regards,
Ramon Rockx
I'm using Hibernate to access a Firebird database. This database
contains the following table:
RECREATE TABLE EMAIL
(
E_ID INTEGER NOT NULL,
...
E_BODY BLOB SUB_TYPE 1 SEGMENT SIZE 4096,
CONSTRAINT PK_EMAIL PRIMARY KEY (E_ID)
);
I created a class Email with a property "body" like this:
/**
* @...
* column="E_BODY"
* type="text"
* @return Body of the email
*/
public String getBody() {
return body;
}
As you can see the Hibernate mapping contains the type "text".
When I try to load an Email object I get the following stacktrace:
java.lang.NullPointerException: charsetName
at java.io.InputStreamReader.<init>
(InputStreamReader.java:82)
at org.firebirdsql.jdbc.field.TranslatingReader.<init>
(TranslatingReader.java:79)
at org.firebirdsql.jdbc.field.TranslatingReader.getInstance
(TranslatingReader.java:54)
at org.firebirdsql.jdbc.field.FBField.getCharacterStream
(FBField.java:603)
at org.firebirdsql.jdbc.FBResultSet.getCharacterStream
(FBResultSet.java:754)
at
org.apache.commons.dbcp.DelegatingResultSet.getCharacterStream
(DelegatingResultSet.java:298)
at net.sf.hibernate.type.TextType.get(TextType.java:29)
at net.sf.hibernate.type.NullableType.nullSafeGet
(NullableType.java:62)
...
To avoid this I can change the Hibernate property type to "string".
However, some other database systems will need this type.
Does anybody know how I can solve this?
I'm using the latest Jaybird driver.
Regards,
Ramon Rockx