[Hibernate-JIRA] Created: (HHH-3975) Sybase doesn't allow to set a null value for text field when save object
by Siuloong Ju (JIRA)
Sybase doesn't allow to set a null value for text field when save object
------------------------------------------------------------------------
Key: HHH-3975
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3975
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Environment: Sybase 15.0.2 development liesence for windows
Hibernate:3.3.1
Reporter: Siuloong Ju
Priority: Critical
Save an object with one field mapped to sybase text type.
if the object text field doesn't be set a not-null value,then the object cann't be save.
HBM file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.test.sybase" default-access="field">
<class name="TestPO" table="TB_TEST">
<id name="id" column="hid" type="long" access="property">
<generator class="native"/>
</id>
<property name="extractID" type="java.lang.String" update="true" insert="true" column="extractID" length="60" not-null="true"/>
<property name="transactionID" type="java.lang.String" update="true" insert="true" column="transactionID" length="60" not-null="false"/>
<property name="testText" column="testText" type="text" not-null="false"/>
</class>
</hibernate-mapping>
the exceptions info:
JZ006: 捕获到 IO 例外:java.io.IOException: JZ0SL: 不受支持的 SQL 类型 2005。
Exception in thread "main" org.hibernate.exception.GenericJDBCException: could not insert: [com.wonders.sybase.TestPO]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:64)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2186)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2666)
at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:71)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:321)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:130)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:562)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:550)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:546)
at com.wonders.sybase.SybaseTest.testSaveByHiberate(SybaseTest.java:39)
at com.wonders.sybase.SybaseTest.main(SybaseTest.java:27)
Caused by: java.sql.SQLException: JZ006: 捕获到 IO 例外:java.io.IOException: JZ0SL: 不受支持的 SQL 类型 2005。
at com.sybase.jdbc3.jdbc.ErrorMessage.raiseError(Unknown Source)
at com.sybase.jdbc3.jdbc.ErrorMessage.raiseErrorCheckDead(Unknown Source)
at com.sybase.jdbc3.tds.Tds.a(Unknown Source)
at com.sybase.jdbc3.tds.Tds.a(Unknown Source)
at com.sybase.jdbc3.tds.Tds.language(Unknown Source)
at com.sybase.jdbc3.jdbc.SybStatement.sendQuery(Unknown Source)
at com.sybase.jdbc3.jdbc.SybPreparedStatement.sendQuery(Unknown Source)
at com.sybase.jdbc3.jdbc.SybStatement.execute(Unknown Source)
at com.sybase.jdbc3.jdbc.SybPreparedStatement.execute(Unknown Source)
at org.hibernate.id.IdentityGenerator$InsertSelectDelegate.executeAndExtract(IdentityGenerator.java:138)
at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:57)
... 17 more
--
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....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 12 months
[Hibernate-JIRA] Created: (HHH-4063) NPE reading metadata from an mapped interface
by Hernán Chanfreau (JIRA)
NPE reading metadata from an mapped interface
---------------------------------------------
Key: HHH-4063
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4063
Project: Hibernate Core
Issue Type: Bug
Components: envers
Affects Versions: 3.3.2
Environment: Hibernate-core 3.3.2GA, Envers 1.2.1GA
Reporter: Hernán Chanfreau
Attachments: interface.mapping.test.zip
The problem arises when there is a mapped interface to load as a persistent class.
The metadata reader from envers do not care about interfaces.
See the discussion about it here:
http://www.jboss.org/index.html?module=bb&op=viewtopic&t=156233
We've patch envers doing this:
In AuditedPropertiesReader.addPropertiesFromClass(XClass clazz) we add the condition superclazz != null.
private void addPropertiesFromClass(XClass clazz) {
XClass superclazz = clazz.getSuperclass();
// superclazz != null applies when superclazz is an interface
if ((superclazz != null) && (!"java.lang.Object".equals(superclazz.getName()))) {
addPropertiesFromClass(superclazz);
}
addFromProperties(clazz.getDeclaredProperties("field"), "field", fieldAccessedPersistentProperties);
addFromProperties(clazz.getDeclaredProperties("property"), "property", propertyAccessedPersistentProperties);
}
--
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....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years