[Hibernate-JIRA] Created: (HHH-3709) Add StartRevision/EndRevison fileds to audit tables
by jason shi (JIRA)
Add StartRevision/EndRevison fileds to audit tables
---------------------------------------------------
Key: HHH-3709
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3709
Project: Hibernate Core
Issue Type: Improvement
Components: envers
Affects Versions: 3.4
Reporter: jason shi
In Envers audit tables(eg:Person_Aud), two fields added:REV,REVTYPE
When retrieve data at special REV, a sql with subselect executed:
select a.id, a.REV, a.REVTYPE, a.name, a.surname, a.address_id
from Person_AUD a
where a.REVTYPE <> ? and a.id = ?
and a.REV = (select max(b.REV) from Person_AUD b where b.REV <= ? and a.id = b.id)
The sql performance is poor.
I suggest adding StartRevision/EndRevison fileds to the audit tables,replace the REV field.
The StartRevision equals the original REV field,EndRevision will be filledd when this record changed in next Revision.
The new query sql will like this:
select a.id, a.REV, a.REVTYPE, a.name, a.surname, a.address_id
from Person_AUD a
where a.REVTYPE <> ? and a.id = ?
and a.StartRevision<=? and a.EndRevision>?
--
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] Commented: (HHH-1904) Identifier too long (reborn)
by Dirk Lachowski (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1904?page=c... ]
Dirk Lachowski commented on HHH-1904:
-------------------------------------
Any news on this?
> Identifier too long (reborn)
> ----------------------------
>
> Key: HHH-1904
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1904
> Project: Hibernate Core
> Issue Type: Bug
> Affects Versions: 3.2.0.cr2
> Reporter: Andrea Aime
>
> I'm following up form HHH-355, basically, foreign keys with names that go well beying 30 chars of lenght.
> I know how to reproduce the problem, and if required I can provide a test case, but let me point you to
> the code path that generates the problem first (and see if that's enough).
> I do have a hierarchy mapped with the table per class approach, with intermediate abstract classes.
> Leaf classes of this hierarchy are apparently managed in hibernate usign the DenormalizedTable class. The code that generates the foreign keys for this class is:
> public void createForeignKeys() {
> includedTable.createForeignKeys();
> Iterator iter = includedTable.getForeignKeyIterator();
> while ( iter.hasNext() ) {
> ForeignKey fk = (ForeignKey) iter.next();
> createForeignKey(
> fk.getName() + Integer.toHexString( getName().hashCode() ),
> fk.getColumns(),
> fk.getReferencedEntityName()
> );
> }
> }
> As you can see, it gets the foreign key name of the contained class, and appends another hexstring. This name can become really long if the
> hierarchy has many levels. In my case I get names as long as: FK14F780C41886F83e63ff56e238e868d73630607.
> Let me know if this is enough or if you need more information.
> Ah, another problem is that the appended foreign parts do not pass thru the naming strategy, and as you can see they're not
> uppercase in my sample (my naming strategy does uppercase everything)
--
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