[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3741) Join tables are not audited if the join is defined in an abstract

praveen s (JIRA) noreply at atlassian.com
Wed May 20 04:32:13 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3741?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33209#action_33209 ] 

praveen s commented on HHH-3741:
--------------------------------

i am using envers 1.2.0.GA-hibernate-3.3 version and hibernate 3.3.1.GA vesrion, attched are the abstract class basecurrentmaintenance.java and class currentmaintenance.java which extends abstract class, I am using following method to get the results from currentscheduledmaintenanceclass by supplying an id

@SuppressWarnings("unchecked")
    public List<BaseCurrentMaintenance> 
        findAuditCurrentMaintenanceByWorkstreamMaintenance(Long id) {
    	
        List<BaseCurrentMaintenance> list;
    	AuditReader reader = AuditReaderFactory.get(this.getSession());
    	AuditQuery query = reader.createQuery()
            .forRevisionsOfEntity(
                CurrentScheduledMaintenance.class, false, false)
            .add(AuditEntity.relatedId(
                   "workstreamMaintenance").eq(id));

    	
    	list = query.getResultList();
    	log.debug("query is"+query.toString());

    	
    	return list;
    }

but    /**
     * {@inheritDoc}
     */
    @ManyToOne(fetch = FetchType.EAGER)	
    @JoinColumn(name = "maintenanceStatusId")
    @AuditJoinTable(name="MaintenanceStatus_AUD", 
		inverseJoinColumns = @JoinColumn(name="maintenanceStatusId"))
    public MaintenanceStatus getMaintenanceStatus() {
        return maintenanceStatus;
    } 
in basecurrentmaintenance class return null values 

please advise the soultion

> Join tables are not audited if the join is defined in an abstract 
> ------------------------------------------------------------------
>
>                 Key: HHH-3741
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3741
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: envers
>    Affects Versions: 3.5
>         Environment: JBoss 4.2.3
> Seam 2.1
> Hibernate 3.4
> Envers 3.4
> PostgreSQL 8.3
>            Reporter: David Lilley
>            Assignee: Adam Warski
>             Fix For: 3.5
>
>         Attachments: BaseCurrentMaintenance.java, CurrentScheduledMaintenance.java, EnversTest.zip
>
>
> I have an abstract with a one-to-many relationship to to another abstract. I defined a join table and an audit join table for the one-to-many relationship.
> The abstract classes are extended to "Set" and "Item" classes using the joined inheritance type. (Set and Item aren't the real names of course; the names have been scrubbed to protect the innocent.)
> The tables and audit tables are all created correctly. When I run my tests, the entities and relationship tables are correctly populated, and the entities' audit tables are populated. However, the audit table for the relationships are empty. (i.e., Item, Item_aud, Set, Set_aud, Set_Item all have the proper data, but Set_Item_aud doesn't have any data.)
> I tested a non-abstract class that has a similar one-to-many relationship, using the same hibernate annotations, with the same type of join table and audit join table. When I run my tests, all tables are correctly populated - including the join audit table. 
> Attached is a complete failing test case, with a SEAM test.

-- 
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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list