[Hibernate-JIRA] Created: (HHH-6209) Envers: ValidityAuditStrategy should support non-generated PKs
by Nikita D (JIRA)
Envers: ValidityAuditStrategy should support non-generated PKs
--------------------------------------------------------------
Key: HHH-6209
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6209
Project: Hibernate Core
Issue Type: Improvement
Components: envers
Affects Versions: 3.6.3
Reporter: Nikita D
I have an entity for storing String key-value pairs (the equivalent of a properties file). The String key is the primary key -- it's not generated, and there is no other generated id. It's not possible to use ValidityAuditStrategy for auditing changes to this entity. The problem is when a row is deleted and later another row is inserted with the same key as the deleted one.
When a row is deleted, a revision of type DEL is added, with the REVEND column set to null. When a row is added with the same PK, a revision of type ADD is added, with the REVEND column set to null. A subsequent call to update the row fails, because ValidityAuditStrategy expects to find exactly one row with a null REVEND value, but at this point there are 2 rows.
The ADD revision should update the REVEND column of the DEL revision, or the DEL revision can set rev = revend = revision at which the del happened.
See http://community.jboss.org/message/594167.
--
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, 5 months
[Hibernate-JIRA] Created: (HHH-6331) Envers @mappedSupperclass bad behaviour
by Facundo Mateo (JIRA)
Envers @mappedSupperclass bad behaviour
---------------------------------------
Key: HHH-6331
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6331
Project: Hibernate Core
Issue Type: Bug
Components: envers
Affects Versions: 3.6.1
Environment: Hibernate 3.6.1.Final
Oracle 10g
Reporter: Facundo Mateo
Suppose you have:
* Class A marked as @MappedSuperclass, and has field/property marked as @Audited
* Class B extends from A, and is @Entity but doesn't have any @Audited annotation
Envers is not auditting instances of B, when it should audit the properties marked with @Audit in the superclass.
I have been researching at the sources , and it seems to be a bug introduced with the fix for [HHH-4646|http://opensource.atlassian.com/projects/hibernate/browse/HHH-4646]. The problem is in the class org.hibernate.envers.configuration.metadata.reader.AuditedPropertiesReader :
{code:title=org.hibernate.envers.configuration.metadata.reader.AuditedPropertiesReader.java|borderStyle=solid}
private void addPropertiesFromClass(XClass clazz) {
Audited allClassAudited = clazz.getAnnotation(Audited.class);
//look in the class
addFromProperties(clazz.getDeclaredProperties("field"), "field", fieldAccessedPersistentProperties, allClassAudited);
addFromProperties(clazz.getDeclaredProperties("property"), "property", propertyAccessedPersistentProperties, allClassAudited);
if(allClassAudited != null || !auditedPropertiesHolder.isEmpty()) {
XClass superclazz = clazz.getSuperclass();
if (!clazz.isInterface() && !"java.lang.Object".equals(superclazz.getName())) {
addPropertiesFromClass(superclazz);
}
}
}
{code}
if you look this line *if(allClassAudited != null || !auditedPropertiesHolder.isEmpty())*: It only looks for @Audited annotation when the child is marked with class level @Audited or if it has some @Audited property/field, but ignores superclass annotations if it the child doesn't have any.
--
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, 5 months
[Hibernate-JIRA] Created: (HHH-6575) Failure to detect dialect because of a failure to obtain connection (HHH00342) should show connection failure exception
by Mike Youngstrom (JIRA)
Failure to detect dialect because of a failure to obtain connection (HHH00342) should show connection failure exception
-----------------------------------------------------------------------------------------------------------------------
Key: HHH-6575
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6575
Project: Hibernate Core
Issue Type: Improvement
Components: core
Affects Versions: 4.0.0.Beta5
Reporter: Mike Youngstrom
I recently upgraded to Hibernate 4 Beta 5 and found it much harder to debug connection errors. My application depends upon Dialect detection and when my app cannot connect to the database I get the following warning with no stacktrace:
JdbcServicesImpl: HHH00342:Could not obtain connection to query metadata : Exception occurred while getting connection: oracle.ucp.UniversalConnectionPoolException: Cannot get Connection from Datasource
I then get a null dialect error because obviously the dialect couldn't be detected and I have no idea of it is a bad password or anything.
I think the Warning above should also display the connection error stack trace like it used to in 3.x. Or at the very least an additional "DEBUG" level message should be logged with the full connection error stacktrace.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 5 months
[Hibernate-JIRA] Created: (HHH-6548) Criteria query involving column @MapKeyJoinColumn
by Anil G (JIRA)
Criteria query involving column @MapKeyJoinColumn
-------------------------------------------------
Key: HHH-6548
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6548
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.6.6
Reporter: Anil G
Priority: Critical
Following is object relationship:
Employee mapping contains
{code:title=Mapping}
@OneToMany(cascade = CascadeType.ALL)
@JoinTable(name = "Emp_Field", joinColumns = @JoinColumn(name = "emp_id"), inverseJoinColumns = @JoinColumn(name = "field_value_id"))
@MapKeyJoinColumn(name = "field_def_id")
public Map<FieldDef, FieldValue> getAttributes() {
return attributes;
}
{code}
*CRUD* works amazingly!, but there exists *Critcal* issue with querying such a fields and adding *Order By*
{code:title=works only value part of query}
DetachedCriteria criteria = DetachedCriteria.forName(Employee.class);
criteria = criteria.createAlias("fields","cf");
criteria = criteria.add(Restrictions.eq("cf.value","boonga"));
List<Employee> list = getHibernateTemplate().findByCriteria(criteria);
{code}
It does not permit query invloving Map.key object and Map.value object. as well as does not permit order by Map.key object...
{code}
fields.key.fieldDef.name="DirectPhone"
fields.value.value = "777%"
{code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 5 months
[Hibernate-JIRA] Created: (HHH-5955) Add support to @OrderColumn JPA2 annotation to work with @AuditMappedBy
by benoit heinrich (JIRA)
Add support to @OrderColumn JPA2 annotation to work with @AuditMappedBy
-----------------------------------------------------------------------
Key: HHH-5955
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5955
Project: Hibernate Core
Issue Type: Bug
Components: envers
Affects Versions: 3.6.1, 3.6.0
Environment: jboss 6.0.0.Final and hibernate 3.6.0.Final
Reporter: benoit heinrich
Hi guys,
I'm working on a project where we're using envers and since we're migrating from jboss 4.2.3 to jboss 6.0.0.Final (finally), I'm then upgrading the old envers to the new one.
Part of the migration I've changed all the @IndexColumn by the new JPA2 @OrderColumn and it seems that envers doesn't work with that new annotation (or I might do something wrong here )
Also, since we're now using the @OrderColumn the "position" column on the referenced entity has been removed as the hibernate documentation (and JPA2 specs) ask for it. Since it's been removed I'm getting the problem.
Here is the example mapping:
{code}
@Entity
@Audited
public class OrganizationEntity {
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true)
@JoinColumn(name = "org_entity_id", columnDefinition = "int", nullable = false)
@OrderColumn(name = "position", columnDefinition = "tinyint", nullable = false)
@AuditMappedBy(mappedBy = "organizationEntity", positionMappedBy = "position")
private List contactDetailList;
}
@Entity
@Audited
public class OrganizationEntityContactDetail {
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "org_entity_id", columnDefinition = "int", nullable = false, insertable = false, updatable = false)
private OrganizationEntity organizationEntity;
}
{code}
Every time I deploy this I'm getting the following error:
{code}
Caused by: org.hibernate.HibernateException: could not init listeners
at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:205) :3.6.0.Final
at org.hibernate.cfg.Configuration.getInitializedEventListeners(Configuration.java:1980) :3.6.0.Final
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1842) :3.6.0.Final
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:902) :3.6.0.Final
... 73 more
Caused by: org.hibernate.MappingException: @AuditMappedBy points to a property that doesn't exist: com.example.services.organization.entity.OrganizationEntityAddress.position
at org.hibernate.envers.configuration.ClassesAuditingData.forcePropertyInsertable(ClassesAuditingData.java:83)
at org.hibernate.envers.configuration.ClassesAuditingData.updateCalculatedFields(ClassesAuditingData.java:72)
at org.hibernate.envers.configuration.EntitiesConfigurator.configure(EntitiesConfigurator.java:86)
at org.hibernate.envers.configuration.AuditConfiguration.(AuditConfiguration.java:97)
at org.hibernate.envers.configuration.AuditConfiguration.getFor(AuditConfiguration.java:129)
at org.hibernate.envers.event.AuditEventListener.initialize(AuditEventListener.java:335)
at org.hibernate.event.EventListeners$1.processListener(EventListeners.java:198) :3.6.0.Final
at org.hibernate.event.EventListeners.processListeners(EventListeners.java:181) :3.6.0.Final
at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:194) :3.6.0.Final
... 76 more
{code}
More details can be read there: http://community.jboss.org/message/589031
Thanks for looking at it :)
Cheers,
/Benoit
--
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, 5 months
[Hibernate-JIRA] Created: (HHH-6324) Hibernate one-to-many relationship together with Oracle integrity referential
by lorenzo pergolini (JIRA)
Hibernate one-to-many relationship together with Oracle integrity referential
-----------------------------------------------------------------------------
Key: HHH-6324
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6324
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.6.0
Environment: JBoss 6.0 standard community edition. Eclipese Helios. Hibernate 3.6.0.
Reporter: lorenzo pergolini
Attachments: model.PNG
We defined a one to many relationship between two tables: Role and RoleAccount.
We managed the integrity referential directly on Oracle.
Our need is to delete one or more RoleAccount related to a Role, but we also need to keep an Oracle integrity referential when we try to delete a Role that has at least a RoleAccount linked.
So what we expect from Hibernate is that there would exist a cascade option, besides delete and delete-orphan, that when trying to delete a Role that has at least a RoleAccount, it doesn't delete first the orphans and then the parents, but the opposite so to raise an integrity referential exception.
Instead if we use delete-orphan option, Hibernate first deletes all the orphan children(RoleAccounts) and then delete the parent(Role), without raising any Oracle integrity referential exception.
We know that this can be done by removing the delete option from cascade (cascade="save-update"), but then we manually have to delete RoleAccounts.
Below I attached part of the mappings and integrity referential sql script:
<!----------------Role -------------->
<bag name="roleFunctions" table="`AdmRoleFunction`" inverse="true" fetch="select" cascade="save-update">
<key>
<column name="`admRoleId`" not-null="true" />
</key>
<one-to-many class="it.apra.logistic.model.admin.RoleFunction" />
</bag>
<!----------------RoleAccounts -------------->
<bag name="roleAccounts" table="`AdmRoleAccount`" inverse="false" fetch="select" cascade="save-update,delete">
<key>
<column name="`admRoleId`" not-null="true" />
</key>
<one-to-many class="it.apra.logistic.model.admin.RoleAccount" />
</bag>
<!------Integrity referential Sql-------------->
ALTER TABLE "AdmRoleAccount" ADD CONSTRAINT "FkAdmRole2" FOREIGN KEY ("admRoleId") REFERENCES "AdmRole" ("id") /
ALTER TABLE "AdmRoleAccount" ADD CONSTRAINT "FkAdmAccount2" FOREIGN KEY ("admAccountId") REFERENCES "AdmAccount" ("id") ON DELETE CASCADE /
--
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, 5 months
[Hibernate-JIRA] Commented: (HHH-1739) HILO id can cause deadlock: Part deux
by Per Olesen (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1739?page=c... ]
Per Olesen commented on HHH-1739:
---------------------------------
I don't have a fix for it, but if using JPA @TableGenerator to map to the MultipleHiLoPerTableGenerator, consider setting the "allocationSize" property to a higher value. This will limit the amount of times, the id/sequence table needs to be touched, making it a lot less probable that the deadlock appears.
See http://www.techper.net/2011/08/15/hibernate-multiplehilopertablegenerator...
> HILO id can cause deadlock: Part deux
> -------------------------------------
>
> Key: HHH-1739
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1739
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1.3
> Environment: Hibernate 3.1.3 running JDK 1.4.1_07 Solaris 5.8
> Adaptive Server Enterprise/12.5.2/EBF 12054 ESD#2/P/Sun_svr4/OS 5.8/ase1252/1844/64-bit/FBO/Thu Aug 12 10:51:11 2004
> Reporter: Kirk Rasmussen
> Original Estimate: 1m
> Remaining Estimate: 1m
>
> This is mostly a duplicate of HB-1246 but with a twist. I believe that there is a flaw in Hibernate's design for how it generates ids for some dialects. This is a particular problem for deep object graphs and/or at high volume. Or at least it is a problem for those of us stuck on the crappy Sybase platform.
> We have an application that creates hundreds of objects that need ids generated within a single transaction. It is quite common for us to potentially exhaust the connection pool with a deep object graph. We are persisting a Trade object which has a complex and deep object graph (upwards of 100s of persistent objects). Within each trade there are roughly 15 classes which need generated ids with 30 or more instances of each class in some cases.
> IMO The design flaw is when the ids are generated. From quickly browsing the source it seems that they are being generated on the fly as the objects are being processed. This can result in running of out database connections when under load or when a particular trade has a large number of persistent object instances and deadlocking the system.
> A better design would be if the ids could be generated for all tables in a single transaction up front rather than issuing a whole bunch of individual transactions for each table and object.
> I believe that TOPLink generates all its ids up front to avoid the described resource thrashing. It also has the configuration to generate ids from within the same transaction as the original unit of work or from a secondary unit of work.
> See org.hibernate.id.MultipleHiLoPerTableGenerator
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 5 months