HHH-7187 - Manual flush mode and @PrimaryKeyJoinColumn tests
This commit is contained in:
parent
b8e356f966
commit
c76810ac47
|
@ -56,6 +56,7 @@ public class DoubleFlushModDel extends AbstractFlushTest {
|
|||
|
||||
StrTestEntity fe = new StrTestEntity("x");
|
||||
em.persist(fe);
|
||||
em.flush();
|
||||
|
||||
em.getTransaction().commit();
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ public class DoubleFlushModMod extends AbstractFlushTest {
|
|||
|
||||
StrTestEntity fe = new StrTestEntity("x");
|
||||
em.persist(fe);
|
||||
em.flush();
|
||||
|
||||
em.getTransaction().commit();
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ public class ManualFlush extends AbstractFlushTest {
|
|||
|
||||
StrTestEntity fe = new StrTestEntity("x");
|
||||
em.persist(fe);
|
||||
em.flush();
|
||||
|
||||
em.getTransaction().commit();
|
||||
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
package org.hibernate.envers.test.integration.onetoone.bidirectional.primarykeyjoincolumn;
|
||||
|
||||
import java.io.Serializable;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.PrimaryKeyJoinColumn;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Parameter;
|
||||
import org.hibernate.envers.Audited;
|
||||
|
||||
/**
|
||||
|
@ -16,13 +19,16 @@ import org.hibernate.envers.Audited;
|
|||
@Audited
|
||||
public class Account implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@Column(name = "ACCOUNT_ID")
|
||||
@GeneratedValue(generator = "AccountForeignKeyGenerator")
|
||||
@GenericGenerator(name = "AccountForeignKeyGenerator", strategy = "foreign",
|
||||
parameters = {@Parameter(name = "property", value = "owner")})
|
||||
private Long accountId;
|
||||
|
||||
private String type;
|
||||
|
||||
@OneToOne(optional = false)
|
||||
@PrimaryKeyJoinColumn
|
||||
@PrimaryKeyJoinColumn(name = "ACCOUNT_ID", referencedColumnName = "PERSON_ID")
|
||||
private Person owner;
|
||||
|
||||
public Account() {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.hibernate.envers.test.integration.onetoone.bidirectional.primarykeyjoincolumn;
|
||||
|
||||
import java.io.Serializable;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
|
@ -17,6 +18,7 @@ import org.hibernate.envers.RelationTargetAuditMode;
|
|||
@Audited
|
||||
public class AccountNotAuditedOwners implements Serializable {
|
||||
@Id
|
||||
@Column(name = "ACCOUNT_ID")
|
||||
@GeneratedValue
|
||||
private Long accountId;
|
||||
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
package org.hibernate.envers.test.integration.onetoone.bidirectional.primarykeyjoincolumn;
|
||||
|
||||
import java.io.Serializable;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.PrimaryKeyJoinColumn;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Parameter;
|
||||
import org.hibernate.annotations.Proxy;
|
||||
|
||||
/**
|
||||
|
@ -16,13 +19,16 @@ import org.hibernate.annotations.Proxy;
|
|||
@Proxy(lazy = false)
|
||||
public class NotAuditedNoProxyPerson implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@Column(name = "PERSON_ID")
|
||||
@GeneratedValue(generator = "NotAuditedNoProxyKeyGenerator")
|
||||
@GenericGenerator(name = "NotAuditedNoProxyKeyGenerator", strategy = "foreign",
|
||||
parameters = {@Parameter(name = "property", value = "account")})
|
||||
private Long personId;
|
||||
|
||||
private String name;
|
||||
|
||||
@OneToOne(optional = false)
|
||||
@PrimaryKeyJoinColumn
|
||||
@PrimaryKeyJoinColumn(name = "PERSON_ID", referencedColumnName = "ACCOUNT_ID")
|
||||
private AccountNotAuditedOwners account;
|
||||
|
||||
public NotAuditedNoProxyPerson() {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.hibernate.envers.test.integration.onetoone.bidirectional.primarykeyjoincolumn;
|
||||
|
||||
import java.io.Serializable;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
|
@ -8,6 +9,8 @@ import javax.persistence.Id;
|
|||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.PrimaryKeyJoinColumn;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Parameter;
|
||||
import org.hibernate.annotations.Proxy;
|
||||
|
||||
/**
|
||||
|
@ -17,13 +20,16 @@ import org.hibernate.annotations.Proxy;
|
|||
@Proxy(lazy = true)
|
||||
public class NotAuditedProxyPerson implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@Column(name = "PERSON_ID")
|
||||
@GeneratedValue(generator = "NotAuditedProxyKeyGenerator")
|
||||
@GenericGenerator(name = "NotAuditedProxyKeyGenerator", strategy = "foreign",
|
||||
parameters = {@Parameter(name = "property", value = "account")})
|
||||
private Long personId;
|
||||
|
||||
private String name;
|
||||
|
||||
@OneToOne(optional = false, fetch = FetchType.LAZY)
|
||||
@PrimaryKeyJoinColumn
|
||||
@PrimaryKeyJoinColumn(name = "PERSON_ID", referencedColumnName = "ACCOUNT_ID")
|
||||
private AccountNotAuditedOwners account;
|
||||
|
||||
public NotAuditedProxyPerson() {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.hibernate.envers.test.integration.onetoone.bidirectional.primarykeyjoincolumn;
|
||||
|
||||
import java.io.Serializable;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
|
@ -15,6 +16,7 @@ import org.hibernate.envers.Audited;
|
|||
@Audited
|
||||
public class Person implements Serializable {
|
||||
@Id
|
||||
@Column(name = "PERSON_ID")
|
||||
@GeneratedValue
|
||||
private Long personId;
|
||||
|
||||
|
|
Loading…
Reference in New Issue