Search in sources :

Example 36 with KeyValue

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

the class TableFacadeTest method testGetIdentifierValue.

@Test
public void testGetIdentifierValue() {
    Table table = new Table();
    ITable tableFacade = FACADE_FACTORY.createTable(table);
    IValue valueFacade = tableFacade.getIdentifierValue();
    assertNull(valueFacade);
    KeyValue value = new SimpleValue(DummyMetadataBuildingContext.INSTANCE, null);
    table.setIdentifierValue(value);
    valueFacade = tableFacade.getIdentifierValue();
    assertSame(value, ((IFacade) valueFacade).getTarget());
}
Also used : Table(org.hibernate.mapping.Table) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) IValue(org.jboss.tools.hibernate.runtime.spi.IValue) KeyValue(org.hibernate.mapping.KeyValue) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) SimpleValue(org.hibernate.mapping.SimpleValue) Test(org.junit.jupiter.api.Test)

Example 37 with KeyValue

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

the class ValueFacadeTest method testGetKey.

@Test
public void testGetKey() {
    Map valueTarget = new Map(DummyMetadataBuildingContext.INSTANCE, null);
    valueFacade = FACADE_FACTORY.createValue(valueTarget);
    assertNull(valueFacade.getKey());
    KeyValue keyValue = new SimpleValue(DummyMetadataBuildingContext.INSTANCE, null);
    valueTarget.setKey(keyValue);
    assertSame(keyValue, ((IFacade) valueFacade.getKey()).getTarget());
}
Also used : KeyValue(org.hibernate.mapping.KeyValue) Map(org.hibernate.mapping.Map) SimpleValue(org.hibernate.mapping.SimpleValue) Test(org.junit.jupiter.api.Test)

Example 38 with KeyValue

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

the class ValueFacadeTest method testSetKey.

@Test
public void testSetKey() {
    KeyValue keyValueTarget = new BasicValue(DummyMetadataBuildingContext.INSTANCE);
    IValue keyValueFacade = new AbstractValueFacade(FACADE_FACTORY, keyValueTarget) {
    };
    Collection collectionTarget = new Bag(DummyMetadataBuildingContext.INSTANCE, null);
    IValue collectionFacade = new AbstractValueFacade(FACADE_FACTORY, collectionTarget) {
    };
    assertNull(collectionTarget.getKey());
    collectionFacade.setKey(keyValueFacade);
    assertSame(keyValueTarget, collectionTarget.getKey());
}
Also used : KeyValue(org.hibernate.mapping.KeyValue) IValue(org.jboss.tools.hibernate.runtime.spi.IValue) AbstractValueFacade(org.jboss.tools.hibernate.runtime.common.AbstractValueFacade) Collection(org.hibernate.mapping.Collection) Bag(org.hibernate.mapping.Bag) IdentifierBag(org.hibernate.mapping.IdentifierBag) BasicValue(org.hibernate.mapping.BasicValue) Test(org.junit.jupiter.api.Test)

Example 39 with KeyValue

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

the class ValueFacadeTest method testGetKey.

@Test
public void testGetKey() {
    Map valueTarget = new Map(DummyMetadataBuildingContext.INSTANCE, null);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, valueTarget) {
    };
    assertNull(valueFacade.getKey());
    KeyValue keyValue = new BasicValue(DummyMetadataBuildingContext.INSTANCE);
    valueTarget.setKey(keyValue);
    assertSame(keyValue, ((IFacade) valueFacade.getKey()).getTarget());
}
Also used : AbstractValueFacade(org.jboss.tools.hibernate.runtime.common.AbstractValueFacade) KeyValue(org.hibernate.mapping.KeyValue) Map(org.hibernate.mapping.Map) BasicValue(org.hibernate.mapping.BasicValue) Test(org.junit.jupiter.api.Test)

Example 40 with KeyValue

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

the class TableFacadeTest method testGetIdentifierValue.

@Test
public void testGetIdentifierValue() {
    Table table = new Table();
    ITable tableFacade = FACADE_FACTORY.createTable(table);
    IValue valueFacade = tableFacade.getIdentifierValue();
    assertNull(valueFacade);
    KeyValue value = new SimpleValue(null);
    table.setIdentifierValue(value);
    valueFacade = tableFacade.getIdentifierValue();
    assertSame(value, ((IFacade) valueFacade).getTarget());
}
Also used : Table(org.hibernate.mapping.Table) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) IValue(org.jboss.tools.hibernate.runtime.spi.IValue) KeyValue(org.hibernate.mapping.KeyValue) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) SimpleValue(org.hibernate.mapping.SimpleValue) Test(org.junit.jupiter.api.Test)

Aggregations

KeyValue (org.hibernate.mapping.KeyValue)53 Test (org.junit.jupiter.api.Test)44 IValue (org.jboss.tools.hibernate.runtime.spi.IValue)35 SimpleValue (org.hibernate.mapping.SimpleValue)33 Collection (org.hibernate.mapping.Collection)13 Bag (org.hibernate.mapping.Bag)12 IdentifierBag (org.hibernate.mapping.IdentifierBag)12 Map (org.hibernate.mapping.Map)12 Table (org.hibernate.mapping.Table)12 ITable (org.jboss.tools.hibernate.runtime.spi.ITable)12 Field (java.lang.reflect.Field)11 RootClass (org.hibernate.mapping.RootClass)11 Iterator (java.util.Iterator)3 BasicValue (org.hibernate.mapping.BasicValue)3 Test (org.junit.Test)3 JoinColumn (javax.persistence.JoinColumn)2 Ejb3JoinColumn (org.hibernate.cfg.Ejb3JoinColumn)2 Property (org.hibernate.mapping.Property)2 AbstractValueFacade (org.jboss.tools.hibernate.runtime.common.AbstractValueFacade)2 ArrayList (java.util.ArrayList)1