Search in sources :

Example 1 with NaturalIdJoinTableEntity

use of com.blazebit.persistence.testsuite.entity.NaturalIdJoinTableEntity in project blaze-persistence by Blazebit.

the class AbstractBookEntityViewTest method prepareData.

@Override
protected void prepareData(EntityManager em) {
    Person p1 = new Person("pers1");
    BookEntity b1 = new BookEntity();
    b1.setOwner(p1);
    b1.setIsbn("123");
    BookEntity b2 = new BookEntity();
    b2.setOwner(p1);
    b2.setIsbn("456");
    BookEntity b3 = new BookEntity();
    b3.setOwner(p1);
    b3.setIsbn("789");
    e1 = new NaturalIdJoinTableEntity();
    e1.setVersion(1L);
    e1.setOwner(p1);
    e1.setIsbn("123");
    e1.getManyToManyBook().put("b1", b1);
    e1.getManyToManyBook().put("b2", b2);
    e1.getOneToManyBook().add(b1);
    e1.getOneToManyBook().add(b2);
    e2 = new BookISBNReferenceEntity();
    e2.setVersion(1L);
    e2.setBook(b1);
    e2.setBookNormal(b2);
    em.persist(p1);
    em.persist(b1);
    em.persist(b2);
    em.persist(b3);
    em.persist(e1);
    em.persist(e2);
}
Also used : BookEntity(com.blazebit.persistence.testsuite.entity.BookEntity) BookISBNReferenceEntity(com.blazebit.persistence.testsuite.entity.BookISBNReferenceEntity) Person(com.blazebit.persistence.testsuite.entity.Person) NaturalIdJoinTableEntity(com.blazebit.persistence.testsuite.entity.NaturalIdJoinTableEntity)

Aggregations

BookEntity (com.blazebit.persistence.testsuite.entity.BookEntity)1 BookISBNReferenceEntity (com.blazebit.persistence.testsuite.entity.BookISBNReferenceEntity)1 NaturalIdJoinTableEntity (com.blazebit.persistence.testsuite.entity.NaturalIdJoinTableEntity)1 Person (com.blazebit.persistence.testsuite.entity.Person)1