[Hibernate-JIRA] Created: (HHH-6259) failure trying to delete an @Entity with a NULL @Version timestamp using postgresql
by radai (JIRA)
failure trying to delete an @Entity with a NULL @Version timestamp using postgresql
-----------------------------------------------------------------------------------
Key: HHH-6259
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6259
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.6.1
Environment: jboss 6, hibernate 3.6.1, postgresql 9.0, JDBC4 driver, windows 7 x64
Reporter: radai
given an @Entity with a Timestamp @Version property that happens to be NULL, hibernate fails to delete the entity, assuming the entity is dirty.
the root cause for this is the PreparedStatement hibernate generates. the sql string looks something along the lines of:
"delete from [table] where [idField]=? and [timestampField]=?"
hibernate then sets the 1st arg to the entity's id (non null) and then calls setNull() to set the 2nd parameter to null (the timestamp property for the entity is null). the postgres JDBC driver doesnt return any error, but executing the statement returns 0 rows, which in turn causes hibernate to assume the entity has been changed in the meantime and throw an exception.
apparently the postgresql jdbc4 driver expects "[timestampField] is null" in the sql string and nothing else.
im not sure if its hibernate or the postgresql driver at fault here, but the overall combnation of the two definitely does not work.
--
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
13 years, 7 months
[Hibernate-JIRA] Created: (HHH-5007) Using <formula> within Composite Element inside Collection
by Hepoi Ko (JIRA)
Using <formula> within Composite Element inside Collection
----------------------------------------------------------
Key: HHH-5007
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5007
Project: Hibernate Core
Issue Type: Patch
Components: core
Affects Versions: 3.5.0-CR-2
Environment: 3.5.0-CR2, AS400, Component
Reporter: Hepoi Ko
Priority: Minor
Attachments: JoinWalker.java
I was one of the user who use Hibernate in a legacy database schema, and always had a issue on using composite-key (and formula) inside collection. I was able to modify the hibernate source (from 3.3.2) to overcome such issue. I am hoping the new version 3.5.0 would even fix this problem. Anyway, I just leave the fix information here, hope it would help.
In /org/hibernate/loader/JoinWalker.java
Line 641: String[] aliasedLhsColumns = StringHelper.qualify(alias, lhsColumns);
Modify with these:
String[] fullAliasedLhsColumns = persister.getElementColumnNames(alias);
String[] aliasedLhsColumns = ArrayHelper.slice(fullAliasedLhsColumns, begin, length);
Without above change I would get NullPointerException on a mapping as
....
<set name="auditRecords" table="OEP40A" order-by="ADAT40 DESC, ATIM40 DESC"
mutable="false" inverse="true" outer-join="true">
<key>
<column name="CONO40"></column>
<column name="ORDN40"></column>
</key>
<composite-element class="com.ricoh.erp.order.domain.OrderAudit">
<property name="userId">
<column name="AUSR40"></column>
</property>
<property name="workstationId">
<column name="AWRK40"></column>
</property>
<many-to-one name="customerEntry" not-found="ignore">
<formula>CONO40</formula> <!-- NullPointerException on this line -->
<column name="CUSN40"></column>
<column name="DSEQ40"></column>
</many-to-one>
</composite-element>
With Best Regards,
--
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
13 years, 7 months
[Hibernate-JIRA] Created: (HHH-5908) unnecessary updates when using select-before-update dirty check with entity that has immutable many-to-one properties.
by Howard Kelsey (JIRA)
unnecessary updates when using select-before-update dirty check with entity that has immutable many-to-one properties.
----------------------------------------------------------------------------------------------------------------------
Key: HHH-5908
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5908
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.6.1, 3.6.0
Reporter: Howard Kelsey
Priority: Critical
Attachments: update-testcase.zip
Entities with many-to-one properties that have insert="false" update="false" are always marked as dirty! This is because when creating the sqlSnapshotSelectString in AbstractEntityPersister.getPropertyUpdateability() is used to identify which properties should be returned in that select and immutable many-to-one props are not. The AbstractEntityPersister.findModified(Object[] old, Object[] current, Object entity, SessionImplementor session) is used to work out if the object has in fact changed, however AbstractEntityPersister.propertyColumnUpdateable is always used to determine which properties are to be checked which means that immutable many-to-one properties are checked even though they're not returned by snapshot select. This is a side effect of the change made for HHH-2350 which changed ManyToOne.isAlwaysDirtyChecked to always return true. So I think it should be changed so that when comparing with the DB snapshot only the properties returned by the AbstractEntityPersister.sqlSnapshotSelectString should be checked by using AbstractEntityPersister.getPropertyUpdateability() instead of AbstractEntityPersister.propertyColumnUpdateable
--
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
13 years, 7 months
[Hibernate-JIRA] Created: (HHH-5901) transient fields are persisted
by Frank Griffin (JIRA)
transient fields are persisted
------------------------------
Key: HHH-5901
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5901
Project: Hibernate Core
Issue Type: Bug
Components: entity-manager
Affects Versions: 3.6.0
Environment: JBoss 6.0.0.Final using Hypersonic
Reporter: Frank Griffin
Attachments: DBUtDVDTitleEntityBean.java
This is virtually identical to ANN-132, which was marked as FIXED in 3.1.
The attached entity bean (DBUtDVDTitleEntityBean) has a "private transient Object oDisks" field. The field is not annotated as @Transient, and the orm.xml does not have a <transient> (or any other) element for the field.
According to spec, the "transient" java attribute should exempt it from persistence. However, if you deploy the EAR containing this Entity Bean, the error
{noformat}
Caused by: org.hibernate.MappingException: property mapping has wrong number of columns: org.profsoftsvcs.dbutils.DVD.DBUtDVDTitleEntityBean.disks type: object
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:464) [:3.6.0.Final]
at org.hibernate.mapping.RootClass.validate(RootClass.java:235) [:3.6.0.Final]
at org.hibernate.cfg.Configuration.validate(Configuration.java:1332) [:3.6.0.Final]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1835) [:3.6.0.Final]
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:902) [:3.6.0.Final]
{noformat}
results. If I change the type "Object" to "Serializable", the error does not occur. However, the fact that "Object" is not Serializable shouldn't matter if the field isn't being persisted.
--
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
13 years, 7 months