Intermittent test failure (Sybase)
This commit is contained in:
parent
f82d381fe3
commit
8c052054a8
|
@ -30,24 +30,32 @@ public class DynamicMapTest {
|
|||
@Test
|
||||
public void bootstrappingTest(SessionFactoryScope scope) {
|
||||
scope.inTransaction( session -> {
|
||||
Map item1 = new HashMap();
|
||||
final Map<String,Object> item1 = new HashMap<>();
|
||||
item1.put( "name", "cup" );
|
||||
item1.put( "description", "abc" );
|
||||
Map entity1 = new HashMap();
|
||||
|
||||
final Map<String,Object> entity1 = new HashMap<>();
|
||||
entity1.put( "name", "first_entity" );
|
||||
item1.put( "entity", entity1 );
|
||||
session.save( "Entity1", entity1 );
|
||||
session.save( "Item1", item1 );
|
||||
|
||||
session.persist( "Entity1", entity1 );
|
||||
session.persist( "Item1", item1 );
|
||||
} );
|
||||
|
||||
scope.inTransaction( session -> {
|
||||
List result = session.createQuery( "from Item1" ).list();
|
||||
//noinspection rawtypes
|
||||
final List<Map> result = session.createSelectionQuery( "from Item1", Map.class ).list();
|
||||
assertThat( result.size(), is( 1 ) );
|
||||
Map item1 = (Map) result.get( 0 );
|
||||
|
||||
//noinspection unchecked
|
||||
final Map<String,Object> item1 = (Map<String, Object>) result.get( 0 );
|
||||
assertThat( item1.get( "name" ), is( "cup" ) );
|
||||
Object entity1 = item1.get( "entity" );
|
||||
|
||||
final Object entity1 = item1.get( "entity" );
|
||||
assertThat( entity1, notNullValue() );
|
||||
assertThat( ( (Map) entity1 ).get( "name" ), is( "first_entity" ) );
|
||||
|
||||
//noinspection unchecked
|
||||
assertThat( ( (Map<String,Object>) entity1 ).get( "name" ), is( "first_entity" ) );
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
|
||||
<class entity-name="ItemBase" abstract="true">
|
||||
<tuplizer entity-mode="dynamic-map" class="org.hibernate.tuple.entity.DynamicMapEntityTuplizer"/>
|
||||
<id name="id" type="uuid-binary" column="id" length="16">
|
||||
<generator class="uuid2" />
|
||||
<id name="id" type="integer" column="id" length="16">
|
||||
<generator class="increment" />
|
||||
</id>
|
||||
<property name="name" type="string" column="name" length="50" not-null="true" />
|
||||
<property name="description" type="string" column="description" length="200" />
|
||||
|
@ -33,8 +33,8 @@
|
|||
|
||||
<class entity-name="Entity1" table="entity_1">
|
||||
<tuplizer entity-mode="dynamic-map" class="org.hibernate.tuple.entity.DynamicMapEntityTuplizer"/>
|
||||
<id name="id" type="uuid-binary" column="id" length="16">
|
||||
<generator class="uuid2" />
|
||||
<id name="id" type="integer" column="id" length="16">
|
||||
<generator class="increment" />
|
||||
</id>
|
||||
<property name="name" type="string" column="name" length="50" not-null="true" />
|
||||
<set name="items" fetch="select" lazy="true" inverse="true">
|
||||
|
@ -45,8 +45,8 @@
|
|||
|
||||
<class entity-name="Entity2" table="entity_2">
|
||||
<tuplizer entity-mode="dynamic-map" class="org.hibernate.tuple.entity.DynamicMapEntityTuplizer"/>
|
||||
<id name="id" type="uuid-binary" column="id" length="16">
|
||||
<generator class="uuid2" />
|
||||
<id name="id" type="integer" column="id" length="16">
|
||||
<generator class="increment" />
|
||||
</id>
|
||||
<property name="name" type="nstring" column="name" length="50" not-null="true" />
|
||||
<set name="items" fetch="select" lazy="true" inverse="true">
|
||||
|
|
Loading…
Reference in New Issue