[Hibernate-JIRA] Created: (HHH-5845) Lazy Loading of audited entites with revision type 'delete'
by Jonas Schlaak (JIRA)
Lazy Loading of audited entites with revision type 'delete'
-----------------------------------------------------------
Key: HHH-5845
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5845
Project: Hibernate Core
Issue Type: Bug
Components: envers
Affects Versions: 3.5.6
Environment: Hibernate 3.5.6, Oracle 10 DB
Reporter: Jonas Schlaak
Two classes are given, and they are related via a OneToOne relationship:
@Audited
public class MyClass {
@OneToOne
@Cascade(value = CascadeType.ALL)
private MyOtherClass otherClass;
}
@Audited
public class MyOtherClass {
}
The property "org.hibernate.envers.store_data_at_delete" is set to true, and when auditquerying for the deleted objects and initiliazing the otherClass (an entity which is also deleted) property, and ObjectNotFoundExceptions is thrown. It seems that the proxies do not look for deleted entities, because the same query works fine for the entities of revision type 'ADD' and 'MOD'. The code of the query:
AuditQuery queryDeleted = reader.createQuery().forRevisionsOfEntity(
MyClass.class, false, true).add(
AuditEntity.revisionType().eq(RevisionType.DEL));
List queryResult = queryDeleted.getResultList();
List<MyClass> result = new ArrayList<MyClass>();
for (Object object : queryResult) {
Object[] oArray = (Object[]) object;
MyClass c = (MyClass) oArray[0];
Hibernate.initialize(c.getOtherClass());
}
Forum post with Adam Warski's response:
http://community.jboss.org/thread/160939?tstart=0
--
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
11 years, 10 months
[Hibernate-JIRA] Created: (HHH-2951) Restrictions.eq when passed null, should create a NullRestriction
by David Sheldon (JIRA)
Restrictions.eq when passed null, should create a NullRestriction
-----------------------------------------------------------------
Key: HHH-2951
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2951
Project: Hibernate3
Issue Type: Improvement
Components: query-criteria
Affects Versions: 3.2.1
Reporter: David Sheldon
Priority: Trivial
If you create a Restriction using eq, and pass null to it, then the generated SQL is "where foo = null", which always returns false.
The programmer will almost certainly have intended to get "where foo is null".
Ideally, we could change:
public static SimpleExpression eq(String propertyName, Object value) {
return new SimpleExpression(propertyName, value, "=");
}
to
public static SimpleExpression eq(String propertyName, Object value) {
if (value == null) {
return isNull(propertyName);
}
else {
return new SimpleExpression(propertyName, value, "=");
}
}
Unforunately that wont work, as isNull doesn't return a SimpleExpression.
--
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
11 years, 10 months
[Hibernate-JIRA] Created: (HHH-6615) int type in Revision number
by Adriano Saturno Muniz (JIRA)
int type in Revision number
---------------------------
Key: HHH-6615
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6615
Project: Hibernate Core
Issue Type: Bug
Components: envers
Affects Versions: 3.6.6
Environment: Hibernata 3.6.6, Oracle
Reporter: Adriano Saturno Muniz
At class DefaultRevisionEntity we have:
@RevisionNumber
private int id;
I made a test setting the HIBERNATE_SEQUENCE to 2,147,483,647. After that, I made an audited update.
The REV column of REVINFO table become negative (int type overflow)
The revision number should be long, at least.
No warnings / exceptions at all could be dangerous. In a overflow all the audit will stop working (envers based the version recoverry in an always increasing REV value, right?). In a very worst scenario, after a long time loosing audit, a primary key violation will happen.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
11 years, 10 months
[Hibernate-JIRA] Created: (HHH-3950) org.hibernate.MappingException: Type not supported for auditing: org.hibernate.type.IdentifierBagType
by David Coleman (JIRA)
org.hibernate.MappingException: Type not supported for auditing: org.hibernate.type.IdentifierBagType
-----------------------------------------------------------------------------------------------------
Key: HHH-3950
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3950
Project: Hibernate Core
Issue Type: Bug
Components: envers
Affects Versions: 3.3.0.GA
Environment: JBoss Envers: jboss-envers-1.2.0.GA-hibernate-3.3 from org.jboss.envers (not on 3.5 of hibernate core yet)
Hibernate Core: hibernate-core-3.3.0.SP1.jar
JBoss + Seam
Reporter: David Coleman
Attachments: TypeIdentifierBagTypeNotSupportedTrace.txt
Hi,
I currenty have a problem with auditing a many-many relation in the entity show below. Initially I had the exact same problem as ´http://opensource.atlassian.com/projects/hibernate/browse/HHH-3843´' but on reading the documentation and releazing that the list contains duplicate elements, I add (as suggested) a @CollectionId annotation to get bag semantics.
Hoewever, the seam application fails to start-up due to the error being thrown from the envers module: "type not supported for auditing: org.hibernate.type.IdentifierBagType, on entity com.baratz.absys2.core.model.api.User, property 'roles'." (stack trace attached)
<snippet>
@Entity
@Audited
@Table(name = "USER_ABSYS")
public class User {
@UserRoles
@ManyToMany
@JoinTable(name = "USER_ROLE",
joinColumns = @JoinColumn(name = "UUNSEQ",unique=false) ,
inverseJoinColumns = @JoinColumn(name = "ROLE_ID",unique=false))
@TableGenerator(name = "UserRolesGen", table = "ABSYS_SEQUENCE", pkColumnName = "ID_NAME", valueColumnName = "NEXT_VAL", pkColumnValue = "USER_ROLE_ID_GEN", allocationSize=1)
@CollectionId(
columns = @Column(name="USER_ROLE_IDX"),
type=@Type(type="long"),
generator="UserRolesGen"
)
public List<Role> getRoles() {
return roles;
}
...
}
</snippet>
Regards,
Dave
--
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
11 years, 10 months