-
1. Re: Getting NotAuditedException using the entity name concept of
adamw Dec 14, 2009 10:03 AM (in response to enversuser)I thought I was using entity-name everywhere, but maybe the place where the conversion from a class name to an entity name happens has a bug. Can you create a small test case and create a JIRA bug?
Adam
-
2. Re: Getting NotAuditedException using the entity name concept of
enversuser Dec 18, 2009 7:48 AM (in response to adamw)Thanks for the reply. I have created the Jira task with sample hibernate mapping project which uses the entity name concept.
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4716 -
3. Re: Getting NotAuditedException using the entity name concept of
hernanbolido May 7, 2010 3:28 PM (in response to enversuser)Hi!
I'm hitting some errors with entity names too.
I could see that ToOneIdMapper.mapToEntityFromMap(AuditConfiguration...) uses the referencedEntityName to load the relation:
...
if (versionsReader.getFirstLevelCache().contains(referencedEntityName, revision, entityId)) {
value = versionsReader.getFirstLevelCache().get(referencedEntityName, revision, entityId);
} else {
Class<?> entityClass = ReflectionTools.loadClass(referencedEntityName);value = versionsReader.getSessionImplementor().getFactory().getEntityPersister(referencedEntityName).
createProxy((Serializable)entityId, new ToOneDelegateSessionImplementor(versionsReader, entityClass, entityId, revision, verCfg));
}
...}
In this case we should obtain the class name for this entity name and load the relation.I´ll have a look at this and try to make a report/patch.
Regards. Hernán.
-
4. Re: Getting NotAuditedException using the entity name concept of
hernanbolido Jun 23, 2010 3:05 PM (in response to hernanbolido)Hi!
I've been working on this issue and developed a posible patch (still beta) for supporting entityName concept of hibernate.
If Adam think that could be posible to add this changes, I can generate a formal patch and post it.
Main points:
- Open AuditReader API in order to obtain historical objects for a given entityName (like Session API of core):public <T> T find(Class<T> cls, String entityName, Object primaryKey, Number revision)...
public List<Number> getRevisions(Class<?> cls, String entityName, Object primaryKey)...
- AbstractAuditQuery hierarchy API add entityName usage instead of using the className as entityName by default:protected AbstractAuditQuery(AuditConfiguration verCfg,
AuditReaderImplementor versionsReader, Class<?> cls, String entityName) {
- EntityConfiguration contains the class name for class instanciation.- ClassNames for relation instantiations are obtained from EntityConfiguration class.
- Tools class add entityName to method getIdentifier() to gives core entityName instead of null.
- ToOneDelegateSessionImplementor changes a little for resolve nonAudited entities correctly.
- Add tests for hbm with entityNames.
Regards. Hernán.
-
5. Re: Getting NotAuditedException using the entity name concept of
adamw Jun 24, 2010 3:23 AM (in response to hernanbolido)Of course, patches are always very welcome . I'll try to review & apply it as soon as you post it .
Adam
-
6. Re: Getting NotAuditedException using the entity name concept of
hernanbolido Jun 25, 2010 11:32 AM (in response to adamw)Hi!
I´m attaching a proposal patch for suppotting this issue, HHH-4716
Adam, please take a look and review my changes when you have some time. All tests passes OK and I've also added some tests for this issue.
Hope it will be helpful!
Best regards, Hernán.
-
7. Re: Getting NotAuditedException using the entity name concept of
adamw Jul 5, 2010 1:04 PM (in response to hernanbolido)Patch applied to trunk - thanks a lot!
Adam
-
8. Re: Getting NotAuditedException using the entity name concept of
hernanbolido Jul 5, 2010 2:15 PM (in response to adamw)Great!
Would it be posible to push it to 3.5 branch?
Thanks. Hernán.
-
9. Re: Getting NotAuditedException using the entity name concept of
adamw Jul 6, 2010 2:31 AM (in response to hernanbolido)Done
Adam