Search in sources :

Example 56 with ManyToOne

use of org.hibernate.mapping.ManyToOne in project jbosstools-hibernate by jbosstools.

the class ValueFacadeTest method testIsManyToOne.

@Test
public void testIsManyToOne() {
    valueTarget = new BasicValue(DummyMetadataBuildingContext.INSTANCE);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, valueTarget) {
    };
    assertFalse(valueFacade.isManyToOne());
    ManyToOne manyToOne = new ManyToOne(DummyMetadataBuildingContext.INSTANCE, null);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, manyToOne) {
    };
    assertTrue(valueFacade.isManyToOne());
}
Also used : AbstractValueFacade(org.jboss.tools.hibernate.runtime.common.AbstractValueFacade) ManyToOne(org.hibernate.mapping.ManyToOne) BasicValue(org.hibernate.mapping.BasicValue) Test(org.junit.jupiter.api.Test)

Example 57 with ManyToOne

use of org.hibernate.mapping.ManyToOne in project jbosstools-hibernate by jbosstools.

the class ValueFacadeTest method testSetReferencedEntityName.

@Test
public void testSetReferencedEntityName() {
    ManyToOne valueTarget = new ManyToOne(DummyMetadataBuildingContext.INSTANCE, null);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, valueTarget) {
    };
    assertNull(valueTarget.getReferencedEntityName());
    valueFacade.setReferencedEntityName("Foo");
    assertEquals("Foo", valueTarget.getReferencedEntityName());
}
Also used : AbstractValueFacade(org.jboss.tools.hibernate.runtime.common.AbstractValueFacade) ManyToOne(org.hibernate.mapping.ManyToOne) Test(org.junit.jupiter.api.Test)

Example 58 with ManyToOne

use of org.hibernate.mapping.ManyToOne in project jbosstools-hibernate by jbosstools.

the class ValueFacadeTest method testSetFetchModeJoin.

@Test
public void testSetFetchModeJoin() {
    SimpleValue simpleValueTarget = new BasicValue(DummyMetadataBuildingContext.INSTANCE);
    assertNotEquals(FetchMode.JOIN, simpleValueTarget.getFetchMode());
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, simpleValueTarget) {
    };
    valueFacade.setFetchModeJoin();
    assertNotEquals(FetchMode.JOIN, simpleValueTarget.getFetchMode());
    Collection collectionTarget = new Bag(DummyMetadataBuildingContext.INSTANCE, null);
    assertNotEquals(FetchMode.JOIN, collectionTarget.getFetchMode());
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, collectionTarget) {
    };
    valueFacade.setFetchModeJoin();
    assertEquals(FetchMode.JOIN, collectionTarget.getFetchMode());
    ManyToOne manyToOneTarget = new ManyToOne(DummyMetadataBuildingContext.INSTANCE, null);
    assertNotEquals(FetchMode.JOIN, manyToOneTarget.getFetchMode());
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, manyToOneTarget) {
    };
    valueFacade.setFetchModeJoin();
    assertEquals(FetchMode.JOIN, manyToOneTarget.getFetchMode());
}
Also used : AbstractValueFacade(org.jboss.tools.hibernate.runtime.common.AbstractValueFacade) Collection(org.hibernate.mapping.Collection) Bag(org.hibernate.mapping.Bag) IdentifierBag(org.hibernate.mapping.IdentifierBag) ManyToOne(org.hibernate.mapping.ManyToOne) SimpleValue(org.hibernate.mapping.SimpleValue) BasicValue(org.hibernate.mapping.BasicValue) Test(org.junit.jupiter.api.Test)

Example 59 with ManyToOne

use of org.hibernate.mapping.ManyToOne in project jbosstools-hibernate by jbosstools.

the class ServiceImplTest method testNewManyToOne.

@Test
public void testNewManyToOne() {
    ITable table = service.newTable("foo");
    IValue manyToOne = service.newManyToOne(table);
    assertNotNull(manyToOne);
    Object target = ((IFacade) manyToOne).getTarget();
    assertNotNull(target);
    assertTrue(target instanceof ManyToOne);
}
Also used : IValue(org.jboss.tools.hibernate.runtime.spi.IValue) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) ManyToOne(org.hibernate.mapping.ManyToOne) Test(org.junit.jupiter.api.Test)

Example 60 with ManyToOne

use of org.hibernate.mapping.ManyToOne in project jbosstools-hibernate by jbosstools.

the class ValueFacadeTest method testSetReferencedEntityName.

@Test
public void testSetReferencedEntityName() {
    ManyToOne valueTarget = new ManyToOne(null, null);
    valueFacade = FACADE_FACTORY.createValue(valueTarget);
    assertNull(valueTarget.getReferencedEntityName());
    valueFacade.setReferencedEntityName("Foo");
    assertEquals("Foo", valueTarget.getReferencedEntityName());
}
Also used : ManyToOne(org.hibernate.mapping.ManyToOne) Test(org.junit.jupiter.api.Test)

Aggregations

ManyToOne (org.hibernate.mapping.ManyToOne)71 Test (org.junit.jupiter.api.Test)55 SimpleValue (org.hibernate.mapping.SimpleValue)29 Collection (org.hibernate.mapping.Collection)14 Bag (org.hibernate.mapping.Bag)13 IdentifierBag (org.hibernate.mapping.IdentifierBag)13 IFacade (org.jboss.tools.hibernate.runtime.common.IFacade)11 ITable (org.jboss.tools.hibernate.runtime.spi.ITable)11 IValue (org.jboss.tools.hibernate.runtime.spi.IValue)11 Component (org.hibernate.mapping.Component)8 Property (org.hibernate.mapping.Property)7 AnnotationException (org.hibernate.AnnotationException)5 AssertionFailure (org.hibernate.AssertionFailure)5 Any (org.hibernate.mapping.Any)5 OneToOne (org.hibernate.mapping.OneToOne)5 PersistentClass (org.hibernate.mapping.PersistentClass)5 Test (org.junit.Test)5 XProperty (org.hibernate.annotations.common.reflection.XProperty)4 Ejb3Column (org.hibernate.cfg.Ejb3Column)4 Ejb3JoinColumn (org.hibernate.cfg.Ejb3JoinColumn)4