HHH-3854 - Fix and test

This commit is contained in:
Lukasz Antoniak 2012-11-11 18:09:22 +01:00
parent 0d2a967fc3
commit 94e13074c1
10 changed files with 703 additions and 13 deletions

View File

@ -0,0 +1,53 @@
package org.hibernate.envers.entities.mapper.relation;
import java.io.Serializable;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.mapper.relation.lazy.ToOneDelegateSessionImplementor;
import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.persister.entity.EntityPersister;
/**
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
*/
public class ToOneEntityLoader {
/**
* Immediately loads historical entity or its current state when excluded from audit process.
*/
public static Object loadImmediate(AuditReaderImplementor versionsReader, Class<?> entityClass, String entityName,
Object entityId, Number revision, AuditConfiguration verCfg) {
if ( verCfg.getEntCfg().getNotVersionEntityConfiguration( entityName ) == null ) {
// Audited relation, look up entity with Envers.
return versionsReader.find( entityClass, entityName, entityId, revision );
}
else {
// Not audited relation, look up entity with Hibernate.
return versionsReader.getSessionImplementor().immediateLoad( entityName, (Serializable) entityId );
}
}
/**
* Creates proxy of referenced *-to-one entity.
*/
public static Object createProxy(AuditReaderImplementor versionsReader, Class<?> entityClass, String entityName,
Object entityId, Number revision, AuditConfiguration verCfg) {
EntityPersister persister = versionsReader.getSessionImplementor().getFactory().getEntityPersister( entityName );
return persister.createProxy(
(Serializable) entityId,
new ToOneDelegateSessionImplementor( versionsReader, entityClass, entityId, revision, verCfg )
);
}
/**
* Creates Hibernate proxy or retrieves the complete object of an entity if proxy is not
* allowed (e.g. @Proxy(lazy=false), final class).
*/
public static Object createProxyOrLoadImmediate(AuditReaderImplementor versionsReader, Class<?> entityClass, String entityName,
Object entityId, Number revision, AuditConfiguration verCfg) {
EntityPersister persister = versionsReader.getSessionImplementor().getFactory().getEntityPersister( entityName );
if ( persister.hasProxy() ) {
return createProxy( versionsReader, entityClass, entityName, entityId, revision, verCfg );
}
return loadImmediate( versionsReader, entityClass, entityName, entityId, revision, verCfg );
}
}

View File

@ -34,6 +34,7 @@ import org.hibernate.envers.entities.mapper.id.IdMapper;
import org.hibernate.envers.entities.mapper.relation.lazy.ToOneDelegateSessionImplementor;
import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.envers.tools.Tools;
import org.hibernate.persister.entity.EntityPersister;
/**
* @author Adam Warski (adam at warski dot org)
@ -95,10 +96,10 @@ public class ToOneIdMapper extends AbstractToOneMapper {
value = versionsReader.getFirstLevelCache().get(referencedEntityName, revision, entityId);
} else {
EntityInfo referencedEntity = getEntityInfo(verCfg, referencedEntityName);
value = versionsReader.getSessionImplementor().getFactory().getEntityPersister(referencedEntityName).
createProxy((Serializable)entityId, new ToOneDelegateSessionImplementor(versionsReader, referencedEntity.getEntityClass(),
entityId, revision, verCfg));
value = ToOneEntityLoader.createProxyOrLoadImmediate(
versionsReader, referencedEntity.getEntityClass(), referencedEntityName,
entityId, revision, verCfg
);
}
}

View File

@ -27,6 +27,7 @@ import java.io.Serializable;
import org.hibernate.HibernateException;
import org.hibernate.envers.configuration.AuditConfiguration;
import org.hibernate.envers.entities.EntitiesConfigurations;
import org.hibernate.envers.entities.mapper.relation.ToOneEntityLoader;
import org.hibernate.envers.reader.AuditReaderImplementor;
/**
@ -41,7 +42,7 @@ public class ToOneDelegateSessionImplementor extends AbstractDelegateSessionImpl
private final Class<?> entityClass;
private final Object entityId;
private final Number revision;
private EntitiesConfigurations entCfg;
private final AuditConfiguration verCfg;
public ToOneDelegateSessionImplementor(AuditReaderImplementor versionsReader,
Class<?> entityClass, Object entityId, Number revision,
@ -51,16 +52,10 @@ public class ToOneDelegateSessionImplementor extends AbstractDelegateSessionImpl
this.entityClass = entityClass;
this.entityId = entityId;
this.revision = revision;
this.entCfg = verCfg.getEntCfg();
this.verCfg = verCfg;
}
public Object doImmediateLoad(String entityName) throws HibernateException {
if(entCfg.getNotVersionEntityConfiguration(entityName) == null){
// audited relation, look up entity with envers
return versionsReader.find(entityClass, entityName, entityId, revision);
} else {
// notAudited relation, look up entity with hibernate
return delegate.immediateLoad(entityName, (Serializable) entityId);
}
return ToOneEntityLoader.loadImmediate( versionsReader, entityClass, entityName, entityId, revision, verCfg );
}
}

View File

@ -0,0 +1,121 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.test.entities.onetoone;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import org.hibernate.annotations.Proxy;
import org.hibernate.envers.Audited;
import org.hibernate.envers.NotAudited;
/**
* Test class for issue HHH-3854. Restricting creation of proxy objects is essential.
*/
@Entity
@Audited
@Proxy(lazy=false)
public final class BidirectionalEagerAnnotationRefEdOneToOne {
/**
* ID column.
*/
@Id
@GeneratedValue
private Integer id;
/**
* Field containing the referring entity.
*/
@OneToOne(mappedBy = "refedOne", fetch = FetchType.EAGER)
@NotAudited
private BidirectionalEagerAnnotationRefIngOneToOne refIng;
/**
* Field containing some data.
*/
private String data;
@Override
public boolean equals(Object o) {
if ( this == o ) return true;
if ( ! ( o instanceof BidirectionalEagerAnnotationRefEdOneToOne ) ) return false;
BidirectionalEagerAnnotationRefEdOneToOne that = (BidirectionalEagerAnnotationRefEdOneToOne) o;
if ( data != null ? !data.equals( that.data ) : that.data != null ) return false;
if ( id != null ? !id.equals( that.id ) : that.id != null ) return false;
return true;
}
@Override
public int hashCode() {
int result = id != null ? id.hashCode() : 0;
result = 31 * result + ( data != null ? data.hashCode() : 0 );
return result;
}
@Override
public String toString() {
return "BidirectionalEagerAnnotationRefEdOneToOne(id = " + id + ", data = " + data + ")";
}
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @return the refIng
*/
public BidirectionalEagerAnnotationRefIngOneToOne getRefIng() {
return refIng;
}
/**
* @param refIng the refIng to set
*/
public void setRefIng(BidirectionalEagerAnnotationRefIngOneToOne refIng) {
this.refIng = refIng;
}
/**
* @return the data
*/
public String getData() {
return data;
}
/**
* @param data the data to set
*/
public void setData(String data) {
this.data = data;
}
}

View File

@ -0,0 +1,143 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.test.entities.onetoone;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import org.hibernate.annotations.Proxy;
import org.hibernate.envers.Audited;
/**
* Test class for issue HHH-3854. Restricting creation of proxy objects is essential.
*/
@Entity
@Audited
@Proxy(lazy=false)
public final class BidirectionalEagerAnnotationRefIngOneToOne {
/**
* ID column.
*/
@Id
@GeneratedValue
private Integer id;
/**
* Field with an optional first referred entity.
*/
@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, optional = true)
@JoinColumn(name = "REF_ID_ONE")
private BidirectionalEagerAnnotationRefEdOneToOne refedOne = null;
/**
* Field with an optional second referred entity.
*/
@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, optional = true)
@JoinColumn(name = "REF_ID_TWO")
private BidirectionalEagerAnnotationRefEdOneToOne refedTwo = null;
/**
* Field containing some data.
*/
private String data;
@Override
public boolean equals(Object o) {
if ( this == o ) return true;
if ( ! ( o instanceof BidirectionalEagerAnnotationRefIngOneToOne ) ) return false;
BidirectionalEagerAnnotationRefIngOneToOne that = (BidirectionalEagerAnnotationRefIngOneToOne) o;
if ( data != null ? !data.equals( that.data ) : that.data != null ) return false;
if ( id != null ? !id.equals( that.id ) : that.id != null ) return false;
return true;
}
@Override
public int hashCode() {
int result = id != null ? id.hashCode() : 0;
result = 31 * result + ( data != null ? data.hashCode() : 0 );
return result;
}
@Override
public String toString() {
return "BidirectionalEagerAnnotationRefIngOneToOne(id = " + id + ", data = " + data + ")";
}
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @return the refedOne
*/
public BidirectionalEagerAnnotationRefEdOneToOne getRefedOne() {
return refedOne;
}
/**
* @param refedOne the refedOne to set
*/
public void setRefedOne(BidirectionalEagerAnnotationRefEdOneToOne refedOne) {
this.refedOne = refedOne;
}
/**
* @return the refedTwo
*/
public BidirectionalEagerAnnotationRefEdOneToOne getRefedTwo() {
return refedTwo;
}
/**
* @param refedTwo the refedTwo to set
*/
public void setRefedTwo(BidirectionalEagerAnnotationRefEdOneToOne refedTwo) {
this.refedTwo = refedTwo;
}
/**
* @return the data
*/
public String getData() {
return data;
}
/**
* @param data the data to set
*/
public void setData(String data) {
this.data = data;
}
}

View File

@ -0,0 +1,88 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.test.entities.onetoone;
import org.hibernate.envers.Audited;
@Audited
public class BidirectionalEagerHbmRefEdPK {
private long id;
private String data;
private BidirectionalEagerHbmRefIngPK referencing;
public BidirectionalEagerHbmRefEdPK() {}
public BidirectionalEagerHbmRefEdPK(String data) {
this.data = data;
}
public long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public BidirectionalEagerHbmRefIngPK getReferencing() {
return referencing;
}
public void setReferencing(BidirectionalEagerHbmRefIngPK referencing) {
this.referencing = referencing;
}
@Override
public boolean equals(Object o) {
if ( this == o ) return true;
if ( ! ( o instanceof BidirectionalEagerHbmRefEdPK ) ) return false;
BidirectionalEagerHbmRefEdPK that = (BidirectionalEagerHbmRefEdPK) o;
if ( id != that.id ) return false;
if ( data != null ? !data.equals( that.data ) : that.data != null ) return false;
return true;
}
@Override
public int hashCode() {
int result = (int) ( id ^ ( id >>> 32 ) );
result = 31 * result + ( data != null ? data.hashCode() : 0 );
return result;
}
@Override
public String toString() {
return "BidirectionalEagerHbmRefEdPK(id = " + id + ", data = " + data + ")";
}
}

View File

@ -0,0 +1,88 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.test.entities.onetoone;
import org.hibernate.envers.Audited;
@Audited
public class BidirectionalEagerHbmRefIngPK {
private long id;
private String data;
private BidirectionalEagerHbmRefEdPK reference;
public BidirectionalEagerHbmRefIngPK() {}
public BidirectionalEagerHbmRefIngPK(String data) {
this.data = data;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public BidirectionalEagerHbmRefEdPK getReference() {
return reference;
}
public void setReference(BidirectionalEagerHbmRefEdPK reference) {
this.reference = reference;
}
@Override
public boolean equals(Object o) {
if ( this == o ) return true;
if ( ! ( o instanceof BidirectionalEagerHbmRefIngPK ) ) return false;
BidirectionalEagerHbmRefIngPK that = (BidirectionalEagerHbmRefIngPK) o;
if ( id != that.id ) return false;
if ( data != null ? !data.equals( that.data ) : that.data != null ) return false;
return true;
}
@Override
public int hashCode() {
int result = (int) ( id ^ ( id >>> 32 ) );
result = 31 * result + ( data != null ? data.hashCode() : 0 );
return result;
}
@Override
public String toString() {
return "BidirectionalEagerHbmRefIngPK(id = " + id + ", data = " + data + ")";
}
}

View File

@ -0,0 +1,81 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.test.integration.onetoone.bidirectional;
import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.onetoone.BidirectionalEagerAnnotationRefEdOneToOne;
import org.hibernate.envers.test.entities.onetoone.BidirectionalEagerAnnotationRefIngOneToOne;
import org.hibernate.testing.TestForIssue;
import static org.junit.Assert.assertNotNull;
/**
* @author Erik-Berndt Scheper
*/
@TestForIssue(jiraKey = "HHH-3854")
public class BidirectionalEagerAnnotationTest extends BaseEnversJPAFunctionalTestCase {
private Integer refIngId1 = null;
@Override
protected Class<?>[] getAnnotatedClasses() {
return new Class<?>[] {
BidirectionalEagerAnnotationRefEdOneToOne.class,
BidirectionalEagerAnnotationRefIngOneToOne.class
};
}
@Test
@Priority(10)
public void initData() {
EntityManager em = getEntityManager();
// Revision 1
em.getTransaction().begin();
BidirectionalEagerAnnotationRefEdOneToOne ed1 = new BidirectionalEagerAnnotationRefEdOneToOne();
BidirectionalEagerAnnotationRefIngOneToOne ing1 = new BidirectionalEagerAnnotationRefIngOneToOne();
ed1.setData( "referredEntity1" );
ed1.setRefIng( ing1 );
ing1.setData( "referringEntity" );
ing1.setRefedOne( ed1 );
em.persist( ed1 );
em.persist( ing1 );
em.getTransaction().commit();
refIngId1 = ing1.getId();
em.close();
}
@Test
public void testNonProxyObjectTraversing() {
BidirectionalEagerAnnotationRefIngOneToOne referencing =
getAuditReader().find( BidirectionalEagerAnnotationRefIngOneToOne.class, refIngId1, 1 );
assertNotNull( referencing.getRefedOne().getData() );
}
}

View File

@ -0,0 +1,75 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.envers.test.integration.onetoone.bidirectional;
import javax.persistence.EntityManager;
import org.junit.Test;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
import org.hibernate.envers.test.Priority;
import org.hibernate.envers.test.entities.onetoone.BidirectionalEagerHbmRefEdPK;
import org.hibernate.envers.test.entities.onetoone.BidirectionalEagerHbmRefIngPK;
import org.hibernate.testing.TestForIssue;
import static org.junit.Assert.assertNotNull;
/**
* @author Erik-Berndt Scheper, Amar Singh
*/
@TestForIssue(jiraKey = "HHH-3854")
public class BidirectionalEagerHbmTest extends BaseEnversJPAFunctionalTestCase {
private Long refIngId1 = null;
@Override
protected String[] getMappings() {
return new String[] { "mappings/oneToOne/bidirectional/eagerLoading.hbm.xml" };
}
@Test
@Priority(10)
public void initData() {
EntityManager em = getEntityManager();
// Revision 1
em.getTransaction().begin();
BidirectionalEagerHbmRefEdPK ed1 = new BidirectionalEagerHbmRefEdPK( "data_ed_1" );
BidirectionalEagerHbmRefIngPK ing1 = new BidirectionalEagerHbmRefIngPK( "data_ing_1" );
ing1.setReference( ed1 );
em.persist( ed1 );
em.persist( ing1 );
em.getTransaction().commit();
refIngId1 = ing1.getId();
em.close();
}
@Test
public void testNonProxyObjectTraversing() {
BidirectionalEagerHbmRefIngPK referencing =
getAuditReader().find( BidirectionalEagerHbmRefIngPK.class, refIngId1, 1 );
assertNotNull( referencing.getReference().getData() );
}
}

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Hibernate, Relational Persistence for Idiomatic Java
~
~ Copyright (c) 2011, Red Hat Inc. or third-party contributors as
~ indicated by the @author tags or express copyright attribution
~ statements applied by the authors. All third-party contributions are
~ distributed under license by Red Hat Inc.
~
~ This copyrighted material is made available to anyone wishing to use, modify,
~ copy, or redistribute it subject to the terms and conditions of the GNU
~ Lesser General Public License, as published by the Free Software Foundation.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
~ for more details.
~
~ You should have received a copy of the GNU Lesser General Public License
~ along with this distribution; if not, write to:
~ Free Software Foundation, Inc.
~ 51 Franklin Street, Fifth Floor
~ Boston, MA 02110-1301 USA
-->
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!-- Test class for issue HHH-3854. Restricting creation of proxy objects is essential. -->
<hibernate-mapping package="org.hibernate.envers.test.entities.onetoone" default-lazy="false">
<class name="BidirectionalEagerHbmRefIngPK" table="BIDIRECTIONAL_REFERENCING_ENTITY">
<id name="id" type="long" column="BIDIRECTIONAL_REFERENCING_ID">
<generator class="native" />
</id>
<property name="data" />
<many-to-one name="reference" cascade="save-update"
class="BidirectionalEagerHbmRefEdPK" column="BIDIRECTIONAL_REFERENCED_ID" />
</class>
<class name="BidirectionalEagerHbmRefEdPK" table="BIDIRECTIONAL_REFERENCED_ENTITY">
<id name="id" type="long" column="BIDIRECTIONAL_REFERENCED_ID">
<generator class="native" />
</id>
<property name="data" />
</class>
</hibernate-mapping>