[Hibernate-JIRA] Created: (HHH-4555) Support use of Envers with Auto-commit mode.
by Kevin Schmidt (JIRA)
Support use of Envers with Auto-commit mode.
--------------------------------------------
Key: HHH-4555
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4555
Project: Hibernate Core
Issue Type: New Feature
Components: envers
Affects Versions: 3.5.0-Beta-2
Environment: Hibernate 3.5.0-Beta-2
Reporter: Kevin Schmidt
Currently Envers is designed so that it synchronizes with the currently running transaction in order to know when to commit the inserts into the Audit Tables. This is an effective strategy for ensuring that the audit information is only saved to the database if the Transactional Unit of Work which caused the audit data to be created is committed.
This design creates a limitation on Envers such that it cannot persist audit information unless there is an active transaction. This effectively disables auditing for anyone modifying data using Hibernate outside of a Hibernate Transaction. Specifically, if you are using Autocommit = True and manually flushing the Hibernate Session then you cannot have any of your data audited using Envers.
I am not that well versed with the design of Envers but was hoping this situation could be detected and avoided. Maybe the audit information could be synchronized on the flush event rather than when a transaction is committed to the database.
--
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, 2 months
[Hibernate-JIRA] Created: (HHH-6981) Inconsistent handling of @Embedded objects wrt null attributes
by Maxime Gamboni (JIRA)
Inconsistent handling of @Embedded objects wrt null attributes
--------------------------------------------------------------
Key: HHH-6981
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6981
Project: Hibernate ORM
Issue Type: Bug
Components: annotations, core
Affects Versions: 3.6.9
Environment: Discovered in Hibernate 3.6.2, verified against Hibernate 3.6.9. Database platform probably irrelevant? (Verified against Oracle JDBC and H2)
Reporter: Maxime Gamboni
First of all, I have to say I am not yet very fluent in Hibernate. I started working on a pre-existing codebase so some subtleties of this are surely escaping me and this is also the reason I might have trouble creating a test case for this bug. I was also not sure which Components to select in this bug report.
Say I have a class A with an @Embedded component B b.
Step 1:
If I saveOrUpdate an instance A a such that:
1) a.b is not null
2) All attributes of a.b.xyz are null
3) All other attributes a.xyz (except from the identifier in case of an update) are null:
This produces a row in the database with all attributes set to null.
Step 2:
If I then attempt to update the object with a separate invocation of saveOrUpdate where a.b is still not null but values of other attributes are irrelevant, Hibernate will execute an insert instead of an update, causing a "Unique index or primary key violation".
I tracked this down to the org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert method:
In step 1, fields contains a non-null B instance, so isAllNull( fields, j ) returns false, so the row is updated with all null values. It is NOT deleted.
In step 2:
1) The oldFields array contains only null values (including the 'b' attribute), causing isAllNull( oldFields, j ) to return true.
2) oldFields itself is not null (in my case, A was part, but not embedded, in another entity that had non-null values for fields outside of table 'j'. Is this relevant?).
This causes the first test to return true, and sets isRowToUpdate to true, so we invoke the insert() method, which fails as we already have a row with the same identifier.
My workaround was to make sure my objects never contain an instance of B whose attributes are all null but this is not ideal. Dropping the test
if ( isNullableTable( j ) && oldFields != null && isAllNull( oldFields, j ) ) isRowToUpdate = false;
would probably solve the problem, but probably at the cost of a lesser efficiency in other cases.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 2 months
[Hibernate-JIRA] Created: (METAGEN-70) BasicAttributeVistor doesn't recognize subclasses of java.io.Serializeable as Attributes.
by kk (JIRA)
BasicAttributeVistor doesn't recognize subclasses of java.io.Serializeable as Attributes.
-----------------------------------------------------------------------------------------
Key: METAGEN-70
URL: http://opensource.atlassian.com/projects/hibernate/browse/METAGEN-70
Project: Hibernate Metamodel Generator
Issue Type: Bug
Components: processor
Affects Versions: 1.1.1.Final
Reporter: kk
Assignee: Hardy Ferentschik
Situation:
Interface 'UnitPersistentValueIF' extends 'PersistentValueIF'.
Interface 'PersistentValueIF' extends 'java.io.Serializable'.
Result:
The annotationprocessor creates attributes for element 'PersistentValueIF'
The annotationprocessor doesn't create attributes for element 'UnitPersistentValueIF'
Expected result:
The annotationprocessor creates for both 'PersistentValueIF' and 'UnitPersistentValueIF' the attributes.
I have debugged the annotationprocessor and this could be the solution:
In BasicAttributeVisitor.java in method visitDeclared(DeclaredType declaredType, Element element)
there is the following code:
if ( "java.io.Serializable".equals( interfaceElement.getQualifiedName().toString() ) ) {
This code should also take into account its superclasses (or interfaces).
Can this be done with 'java.lang.model' ?
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 2 months
[Hibernate-JIRA] Created: (HHH-6977) Extra lazy collection size query invalid postgresql syntax
by Dmitry Murashenkov (JIRA)
Extra lazy collection size query invalid postgresql syntax
-----------------------------------------------------------
Key: HHH-6977
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6977
Project: Hibernate ORM
Issue Type: Bug
Components: core
Affects Versions: 3.6.0
Environment: PostgreSQL 9.1
Reporter: Dmitry Murashenkov
Attempt to use extra-lazy collections with PostgreSQL ends with invalid syntax exception:
ERROR: subquery in FROM must have an alias
The cause is that AbstractCollectionPersister.generateSelectSizeString fills sqlSelectSizeString query via SimpleSelect.toStatementString and it doesn't add an alias to query. Workaround is to append some alias in Dialect.appendLockHint, but not sure if it doesn't break other functionality.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 2 months
[Hibernate-JIRA] Created: (HHH-6958) PrePersist is called on object although no merge/persist operation is cascaded/applied
by Benjamin Diedrichsen (JIRA)
PrePersist is called on object although no merge/persist operation is cascaded/applied
--------------------------------------------------------------------------------------
Key: HHH-6958
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6958
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 4.0.0.Final, 4.0.0.CR2
Environment: JBoss AS 7
Reporter: Benjamin Diedrichsen
Priority: Critical
The scenario: A persistent instance of class A is loaded. A transient object of type b is created and with it a transient object of type c. Then the merge operation is invoked on A.
The unexpected behaviour now is that the @PrePersist method on C is called although the causing merge-operation does not apply (not cascaded from B to C) and is actually not executed on the object (--> C will not be persisted to the database).
Why is PrePersist invoked for C if no persist or merge operation is actually cascaded?
Class A{
@OneToOne(cascade = CascadeType.ALL, optional = true, orphanRemoval = true)
private B b;
}
Class B{
@ManyToOne(optional = false, cascade={CascadeType.PERSIST})
private C c;
}
Class C{
// some basic attributes here
}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 2 months
[Hibernate-JIRA] Created: (HV-552) Need additional AccessController.doPrivileged() for invoking equals() on an instance of Annotation.
by Ed Burns (JIRA)
Need additional AccessController.doPrivileged() for invoking equals() on an instance of Annotation.
---------------------------------------------------------------------------------------------------
Key: HV-552
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-552
Project: Hibernate Validator
Issue Type: Bug
Components: engine
Affects Versions: 4.2.0.Final
Environment: AIX
Reporter: Ed Burns
Priority: Trivial
I have a simple servlet that calls some BV apis, like this:
List<String> listOfString = new ArrayList<String>();
listOfString.add("one");
listOfString.add("two");
listOfString.add("three");
Set<ConstraintViolation<Person>> violations =
beanValidator.validateValue(Person.class, "listOfString", listOfString);
However, when the validateValue() call is made a
java.security.AccessControlException exception is thrown.
The code throwing the exception is
org.hibernate.validator.metadata.ConstraintDescriptorImpl.equals(ConstraintDescriptorImpl.java:289).
The code looks innocent enough:
@Override
public boolean equals(Object o) {
if ( this == o ) {
return true;
}
if ( o == null || getClass() != o.getClass() ) {
return false;
}
ConstraintDescriptorImpl<?> that = (ConstraintDescriptorImpl<?>) o;
if ( annotation != null ? !annotation.equals( that.annotation ) : that.annotation != null ) {
return false;
}
return true;
}
The exception is thrown on the invocation of annotation.equals(), as
shown in this stack trace:
[#|2011-09-12T12:47:22.022-0700|WARNING|glassfish3.1.2|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=8;_ThreadName=Thread-11;|StandardWrapperValve[SimpleBVServlet]: PWC1406: Servlet.service() for servlet SimpleBVServlet threw exception
java.security.AccessControlException: Access denied (java.lang.reflect.ReflectPermission suppressAccessChecks)
at java.security.AccessController.checkPermission(AccessController.java:108)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:544)
at java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject.java:118)
at com.ibm.oti.reflect.AnnotationHelper$AnnotationInvocationHandler.compare(AnnotationHelper.java:186)
at com.ibm.oti.reflect.AnnotationHelper$AnnotationInvocationHandler.invoke(AnnotationHelper.java:111)
at $Proxy15.equals(Unknown Source)
at org.hibernate.validator.metadata.ConstraintDescriptorImpl.equals(ConstraintDescriptorImpl.java:289)
at org.hibernate.validator.metadata.MetaConstraint.equals(MetaConstraint.java:106)
at java.util.ArrayList.contains(ArrayList.java:305)
at org.hibernate.validator.engine.ValidatorImpl.validatePropertyForDefaultGroup(ValidatorImpl.java:821)
at org.hibernate.validator.engine.ValidatorImpl.validatePropertyForCurrentGroup(ValidatorImpl.java:742)
at org.hibernate.validator.engine.ValidatorImpl.validateValueInContext(ValidatorImpl.java:699)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 2 months
[Hibernate-JIRA] Created: (METAGEN-66) XML Based Mapping of Embeddets in Mapped-Superclass is ignored
by Ralph Engelmann (JIRA)
XML Based Mapping of Embeddets in Mapped-Superclass is ignored
--------------------------------------------------------------
Key: METAGEN-66
URL: http://opensource.atlassian.com/projects/hibernate/browse/METAGEN-66
Project: Hibernate Metamodel Generator
Issue Type: Bug
Affects Versions: 1.1.1.Final
Environment: Meta model generator for Hibernate (Version 1.1.1-Final), Hiberante 3.6.1.Final, Spring 3.0
Reporter: Ralph Engelmann
Assignee: Hardy Ferentschik
I use a Mapped Superclass, which refer to an (generic) Embeddded.
Because this class is located in an different jar I needto map this class explicit in XML.
But the Hibernate Model Generator does not create an field in the Meta Model of the Mapped Superclass that represent the Embedded.
See the code for illustration.
{code:title=Mapped Superclass(BusinessEntity<T>)}
public abstract class BusinessEntity<T extends Serializable>
implements Serializable {
private Long id;
private BusinessId<T> businessId;
...
}
{code}
{code:title=Generic Embedded (BusinessId<T>)}
public class BusinessId<T> implements Serializable {
private long businessId;
...
}
{code}
{code:title=orm.xml}
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm
http://java.sun.com/xml/ns/persistence/orm_2_0.xsd"
version="2.0">
<mapped-superclass class="BusinessEntity"
access="FIELD">
<attributes>
<id name="id">
<column nullable="false"/>
<generated-value strategy="AUTO"/>
</id>
<embedded name="businessId"/>
</attributes>
</mapped-superclass>
<embeddable class="BusinessId"
access="FIELD">
<attributes>
<basic name="businessId">
<column nullable="false" unique="true"/>
</basic>
</attributes>
</embeddable>
</entity-mappings>
{code}
{code:title=Generated Meta Model (BusinessEntity_)}
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@StaticMetamodel(BusinessEntity.class)
public abstract class BusinessEntity_ {
public static volatile SingularAttribute<BusinessEntity, Long> id;
}
{code}
{code:title=Generated Meta Model (BusinessId_)}
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@StaticMetamodel(BusinessId.class)
public abstract class BusinessId_ {
public static volatile SingularAttribute<BusinessId, Long> businessId;
}
{code}
--
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, 2 months