code
stringlengths
23
201k
docstring
stringlengths
17
96.2k
func_name
stringlengths
0
235
language
stringclasses
1 value
repo
stringlengths
8
72
path
stringlengths
11
317
url
stringlengths
57
377
license
stringclasses
7 values
@Test public void testAssociationIsNullInWhereClause(SessionFactoryScope scope) { final SQLStatementInspector inspector = scope.getCollectingStatementInspector(); scope.inTransaction( session -> { inspector.clear(); // should produce a left join to ACCOUNT_TABLE and restrict based on the Account's id - /...
@author Marco Belladelli @see org.hibernate.orm.test.notfound.IsNullAndNotFoundTest
testAssociationIsNullInWhereClause
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/IsNullAndMappedByTest.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/IsNullAndMappedByTest.java
Apache-2.0
@Test public void testFetchedAssociationIsNullInWhereClause(SessionFactoryScope scope) { final SQLStatementInspector inspector = scope.getCollectingStatementInspector(); scope.inTransaction( session -> { inspector.clear(); // should produce an inner join to ACCOUNT_TABLE since it's explicitly selected //...
@author Marco Belladelli @see org.hibernate.orm.test.notfound.IsNullAndNotFoundTest
testFetchedAssociationIsNullInWhereClause
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/IsNullAndMappedByTest.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/IsNullAndMappedByTest.java
Apache-2.0
@Test public void testIsNullInWhereClause3(SessionFactoryScope scope) { final SQLStatementInspector inspector = scope.getCollectingStatementInspector(); scope.inTransaction( session -> { inspector.clear(); final List<Integer> ids = session.createQuery( "select distinct a.id from Account a where fk(a.pe...
@author Marco Belladelli @see org.hibernate.orm.test.notfound.IsNullAndNotFoundTest
testIsNullInWhereClause3
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/IsNullAndMappedByTest.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/IsNullAndMappedByTest.java
Apache-2.0
@Test public void testAssociationEqualsInWhereClause(SessionFactoryScope scope) { final SQLStatementInspector inspector = scope.getCollectingStatementInspector(); scope.inTransaction( session -> { inspector.clear(); // at the moment - // // select // distinct p1_0.id // from // ...
@author Marco Belladelli @see org.hibernate.orm.test.notfound.IsNullAndNotFoundTest
testAssociationEqualsInWhereClause
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/IsNullAndMappedByTest.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/IsNullAndMappedByTest.java
Apache-2.0
@Test public void testIsNullInWhereClause5(SessionFactoryScope scope) { scope.inTransaction( session -> { final List<Integer> ids = session.createQuery( "select p.id from Person p where p.account.code is null or p.account.id is null", Integer.class ) .getResultList(); assertEquals( 1, ...
@author Marco Belladelli @see org.hibernate.orm.test.notfound.IsNullAndNotFoundTest
testIsNullInWhereClause5
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/IsNullAndMappedByTest.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/IsNullAndMappedByTest.java
Apache-2.0
@Test public void testWhereClause(SessionFactoryScope scope) { scope.inTransaction( session -> { final List<Integer> ids = session.createQuery( "select p.id from Person p where p.account.code = :code and p.account.id = :id", Integer.class ) .setParameter( "code", "Fab" ) .setParameter...
@author Marco Belladelli @see org.hibernate.orm.test.notfound.IsNullAndNotFoundTest
testWhereClause
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/IsNullAndMappedByTest.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/IsNullAndMappedByTest.java
Apache-2.0
@Test public void testDelete(SessionFactoryScope scope) { final SQLStatementInspector inspector = scope.getCollectingStatementInspector(); inspector.clear(); scope.inTransaction( (entityManager) -> { entityManager.createMutationQuery( "delete from Person p where p.account is null" ).executeUpdate(); asse...
@author Marco Belladelli @see org.hibernate.orm.test.notfound.IsNullAndNotFoundTest
testDelete
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/IsNullAndMappedByTest.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/IsNullAndMappedByTest.java
Apache-2.0
@Test public void testHqlUpdate(SessionFactoryScope scope) { final SQLStatementInspector inspector = scope.getCollectingStatementInspector(); inspector.clear(); scope.inTransaction( (entityManager) -> { entityManager.createMutationQuery( "update Person p set p.name = 'abc' where p.account is null" ).executeU...
@author Marco Belladelli @see org.hibernate.orm.test.notfound.IsNullAndNotFoundTest
testHqlUpdate
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/IsNullAndMappedByTest.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/IsNullAndMappedByTest.java
Apache-2.0
@Test public void testHqlUpdateSet(SessionFactoryScope scope) { final SQLStatementInspector inspector = scope.getCollectingStatementInspector(); inspector.clear(); scope.inTransaction( (entityManager) -> { entityManager.createMutationQuery( "update Account a set a.person = null where id = 99" ).executeUpdate...
@author Marco Belladelli @see org.hibernate.orm.test.notfound.IsNullAndNotFoundTest
testHqlUpdateSet
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/IsNullAndMappedByTest.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/IsNullAndMappedByTest.java
Apache-2.0
public Integer getId() { return id; }
@author Marco Belladelli @see org.hibernate.orm.test.notfound.IsNullAndNotFoundTest
getId
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/IsNullAndMappedByTest.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/IsNullAndMappedByTest.java
Apache-2.0
public String getName() { return name; }
@author Marco Belladelli @see org.hibernate.orm.test.notfound.IsNullAndNotFoundTest
getName
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/IsNullAndMappedByTest.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/IsNullAndMappedByTest.java
Apache-2.0
public Account getAccount() { return account; }
@author Marco Belladelli @see org.hibernate.orm.test.notfound.IsNullAndNotFoundTest
getAccount
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/IsNullAndMappedByTest.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mappedBy/IsNullAndMappedByTest.java
Apache-2.0
public Integer getId() { return id; }
Used as example entity in UG @author Steve Ebersole
getId
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/MutabilityBaselineEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/MutabilityBaselineEntity.java
Apache-2.0
public String getName() { return name; }
Used as example entity in UG @author Steve Ebersole
getName
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/MutabilityBaselineEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/MutabilityBaselineEntity.java
Apache-2.0
public void setName(String name) { this.name = name; }
Used as example entity in UG @author Steve Ebersole
setName
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/MutabilityBaselineEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/MutabilityBaselineEntity.java
Apache-2.0
public Date getActiveTimestamp() { return activeTimestamp; }
Used as example entity in UG @author Steve Ebersole
getActiveTimestamp
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/MutabilityBaselineEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/MutabilityBaselineEntity.java
Apache-2.0
public void setActiveTimestamp(Date activeTimestamp) { this.activeTimestamp = activeTimestamp; }
Used as example entity in UG @author Steve Ebersole
setActiveTimestamp
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/MutabilityBaselineEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/MutabilityBaselineEntity.java
Apache-2.0
void stringExample() { //tag::mutability-base-string-example[] Session session = getSession(); MutabilityBaselineEntity entity = session.find( MutabilityBaselineEntity.class, 1 ); entity.setName( "new name" ); //end::mutability-base-string-example[] }
Used as example entity in UG @author Steve Ebersole
stringExample
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/MutabilityBaselineEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/MutabilityBaselineEntity.java
Apache-2.0
private void dateExampleSet() { //tag::mutability-base-date-set-example[] Session session = getSession(); MutabilityBaselineEntity entity = session.find( MutabilityBaselineEntity.class, 1 ); entity.setActiveTimestamp( now() ); //end::mutability-base-date-set-example[] }
Used as example entity in UG @author Steve Ebersole
dateExampleSet
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/MutabilityBaselineEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/MutabilityBaselineEntity.java
Apache-2.0
private void dateExampleMutate() { //tag::mutability-base-date-mutate-example[] Session session = getSession(); MutabilityBaselineEntity entity = session.find( MutabilityBaselineEntity.class, 1 ); entity.getActiveTimestamp().setTime( now().getTime() ); //end::mutability-base-date-mutate-example[] }
Used as example entity in UG @author Steve Ebersole
dateExampleMutate
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/MutabilityBaselineEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/MutabilityBaselineEntity.java
Apache-2.0
private Session getSession() { return null; }
Used as example entity in UG @author Steve Ebersole
getSession
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/MutabilityBaselineEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/MutabilityBaselineEntity.java
Apache-2.0
private Date now() { return Date.from( Instant.now() ); }
Used as example entity in UG @author Steve Ebersole
now
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/MutabilityBaselineEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/MutabilityBaselineEntity.java
Apache-2.0
@Test public void verifyDomainModel(DomainModelScope domainModelScope, SessionFactoryScope sfSessionFactoryScope) { final PersistentClass persistentClass = domainModelScope .getDomainModel() .getEntityBinding( TheEntity.class.getName() ); final EntityPersister entityDescriptor = sfSessionFactoryScope.getSe...
Tested premises: 1. `@Immutable` on a basic attribute - * not-updateable * immutable 2. `@Mutability(Immutability.class)` on basic attribute * updateable * immutable @author Steve Ebersole
verifyDomainModel
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/BasicAttributeMutabilityTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/BasicAttributeMutabilityTests.java
Apache-2.0
@Test public void testImmutableManaged(SessionFactoryScope scope) { scope.inTransaction( (session) -> { session.persist( new TheEntity( 1, "@Immutable test", Date.from( START ) ) ); } ); // try to update the managed form scope.inTransaction( (session) -> { //tag::attribute-immutable-managed-example[] ...
`@Immutable` attribute while managed - no update
testImmutableManaged
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/BasicAttributeMutabilityTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/BasicAttributeMutabilityTests.java
Apache-2.0
@Test public void testImmutableDetached(SessionFactoryScope scope) { scope.inTransaction( (session) -> { session.persist( new TheEntity( 1, "@Immutable test", Date.from( START ) ) ); } ); // load a detached reference final TheEntity detached = scope.fromTransaction( (session) -> { final TheEntity theEnt...
`@Immutable` attribute on merged detached value - no update (its non-updateable)
testImmutableDetached
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/BasicAttributeMutabilityTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/BasicAttributeMutabilityTests.java
Apache-2.0
@Test public void testImmutabilityManaged(SessionFactoryScope scope) { scope.inTransaction( (session) -> { session.persist( new TheEntity( 1, "@Mutability test", Date.from( START ) ) ); } ); // try to update the managed form scope.inTransaction( (session) -> { //tag::attribute-immutability-managed-examp...
`@Mutability(Immutability.class)` attribute while managed - no update
testImmutabilityManaged
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/BasicAttributeMutabilityTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/BasicAttributeMutabilityTests.java
Apache-2.0
@Test public void testImmutabilityDetached(SessionFactoryScope scope) { scope.inTransaction( (session) -> { session.persist( new TheEntity( 1, "@Mutability test", Date.from( START ) ) ); } ); // load a detached reference final TheEntity detached = scope.fromTransaction( (session) -> session.find( TheEntity...
`@Mutability(Immutability.class)` attribute while managed - update because we cannot distinguish one type of change from another while detached
testImmutabilityDetached
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/BasicAttributeMutabilityTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/BasicAttributeMutabilityTests.java
Apache-2.0
@Test void verifyMetamodel(DomainModelScope domainModelScope, SessionFactoryScope sessionFactoryScope) { domainModelScope.withHierarchy( TestEntity.class, (entity) -> { final Property property = entity.getProperty( "data" ); assertThat( property.isUpdateable() ).isTrue(); final BasicValue value = (BasicVal...
@implNote Uses a converter just for helping with the Map part. It is the {@link Mutability} usage that is important @author Steve Ebersole
verifyMetamodel
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/ImmutabilityMapAsBasicTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/ImmutabilityMapAsBasicTests.java
Apache-2.0
@Test @JiraKey( "HHH-16132" ) void testDirtyCheckingManaged(SessionFactoryScope scope) { final SQLStatementInspector statementInspector = scope.getCollectingStatementInspector(); // mutate the managed entity state - should not trigger update since it is immutable scope.inTransaction( (session) -> { // load ...
@implNote Uses a converter just for helping with the Map part. It is the {@link Mutability} usage that is important @author Steve Ebersole
testDirtyCheckingManaged
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/ImmutabilityMapAsBasicTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/ImmutabilityMapAsBasicTests.java
Apache-2.0
@Test @JiraKey( "HHH-16132" ) void testDirtyCheckingMerge(SessionFactoryScope scope) { final SQLStatementInspector statementInspector = scope.getCollectingStatementInspector(); // load a detached reference final TestEntity detached = scope.fromTransaction( (session) -> session.get( TestEntity.class, 1 ) ); a...
Illustrates how we can't really detect that an "internal state" mutation happened while detached. When merged, we just see a different value.
testDirtyCheckingMerge
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/ImmutabilityMapAsBasicTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/ImmutabilityMapAsBasicTests.java
Apache-2.0
@Test @JiraKey( "HHH-16132" ) void testNotDirtyCheckingManaged(SessionFactoryScope scope) { final SQLStatementInspector statementInspector = scope.getCollectingStatementInspector(); // make no changes to a managed entity scope.inTransaction( (session) -> { // Load a managed reference final TestEntity man...
Illustrates how we can't really detect that an "internal state" mutation happened while detached. When merged, we just see a different value.
testNotDirtyCheckingManaged
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/ImmutabilityMapAsBasicTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/ImmutabilityMapAsBasicTests.java
Apache-2.0
@Test @JiraKey( "HHH-16132" ) void testNotDirtyCheckingMerge(SessionFactoryScope scope) { final SQLStatementInspector statementInspector = scope.getCollectingStatementInspector(); // load a detached instance final TestEntity detached = scope.fromTransaction( (session) -> session.get( TestEntity.class, 1 ) ); ...
Illustrates how we can't really detect that an "internal state" mutation happened while detached. When merged, we just see a different value.
testNotDirtyCheckingMerge
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/ImmutabilityMapAsBasicTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/ImmutabilityMapAsBasicTests.java
Apache-2.0
@BeforeEach void createTestData(SessionFactoryScope scope) { scope.inTransaction( (session) -> { session.persist( new TestEntity( 1, Map.of( "abc", "123", "def", "456" ) ) ); } ); }
Illustrates how we can't really detect that an "internal state" mutation happened while detached. When merged, we just see a different value.
createTestData
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/ImmutabilityMapAsBasicTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/ImmutabilityMapAsBasicTests.java
Apache-2.0
@AfterEach void dropTestData(SessionFactoryScope scope) { scope.inTransaction( (session) -> { session.createMutationQuery( "delete TestEntity" ).executeUpdate(); } ); }
Illustrates how we can't really detect that an "internal state" mutation happened while detached. When merged, we just see a different value.
dropTestData
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/ImmutabilityMapAsBasicTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/ImmutabilityMapAsBasicTests.java
Apache-2.0
@Test void verifyMetamodel(DomainModelScope domainModelScope, SessionFactoryScope sessionFactoryScope) { final PersistentClass persistentClass = domainModelScope .getDomainModel() .getEntityBinding( TestEntity.class.getName() ); final EntityPersister entityDescriptor = sessionFactoryScope .getSessionFa...
Tests for `@Immutable` on a map-as-basic attribute Essentially the same as the `@Immutable` checks in {@link BasicAttributeMutabilityTests} in {@link BasicAttributeMutabilityTests#testImmutableManaged}, {@link BasicAttributeMutabilityTests#testImmutableDetached} and {@link BasicAttributeMutabilityTests#verifyDomainMod...
verifyMetamodel
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/ImmutableMapAsBasicTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/ImmutableMapAsBasicTests.java
Apache-2.0
@Test @JiraKey( "HHH-16132" ) void testDirtyCheckingManaged(SessionFactoryScope scope) { final SQLStatementInspector statementInspector = scope.getCollectingStatementInspector(); // mutate the managed entity state scope.inTransaction( (session) -> { // load a managed reference final TestEntity managed = ...
Because `@Immutable` implies non-updateable, changes are ignored (no UPDATE)
testDirtyCheckingManaged
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/ImmutableMapAsBasicTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/ImmutableMapAsBasicTests.java
Apache-2.0
@Test @JiraKey( "HHH-16132" ) void testDirtyCheckingMerge(SessionFactoryScope scope) { final SQLStatementInspector statementInspector = scope.getCollectingStatementInspector(); // load a detached reference final TestEntity detached = scope.fromTransaction( (session) -> session.get( TestEntity.class, 1 ) ); a...
Because `@Immutable` implies non-updateable, changes are ignored (no UPDATE)
testDirtyCheckingMerge
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/ImmutableMapAsBasicTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/ImmutableMapAsBasicTests.java
Apache-2.0
@Test @JiraKey( "HHH-16132" ) void testNotDirtyCheckingManaged(SessionFactoryScope scope) { final SQLStatementInspector statementInspector = scope.getCollectingStatementInspector(); // make no changes to a managed entity scope.inTransaction( (session) -> { // Load a managed reference final TestEntity man...
Because `@Immutable` implies non-updateable, changes are ignored (no UPDATE)
testNotDirtyCheckingManaged
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/ImmutableMapAsBasicTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/ImmutableMapAsBasicTests.java
Apache-2.0
@Test @JiraKey( "HHH-16132" ) void testNotDirtyCheckingMerge(SessionFactoryScope scope) { final SQLStatementInspector statementInspector = scope.getCollectingStatementInspector(); // load a detached instance final TestEntity detached = scope.fromTransaction( (session) -> session.get( TestEntity.class, 1 ) ); ...
Because `@Immutable` implies non-updateable, changes are ignored (no UPDATE)
testNotDirtyCheckingMerge
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/ImmutableMapAsBasicTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/ImmutableMapAsBasicTests.java
Apache-2.0
@BeforeEach void createTestData(SessionFactoryScope scope) { scope.inTransaction( (session) -> { session.persist( new TestEntity( 1, Map.of( "abc", "123", "def", "456" ) ) ); } ); }
Because `@Immutable` implies non-updateable, changes are ignored (no UPDATE)
createTestData
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/ImmutableMapAsBasicTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/ImmutableMapAsBasicTests.java
Apache-2.0
@AfterEach void dropTestData(SessionFactoryScope scope) { scope.inTransaction( (session) -> { session.createMutationQuery( "delete TestEntity" ).executeUpdate(); } ); }
Because `@Immutable` implies non-updateable, changes are ignored (no UPDATE)
dropTestData
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/ImmutableMapAsBasicTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/attribute/ImmutableMapAsBasicTests.java
Apache-2.0
@Override public String convertToDatabaseColumn(Date date) { if ( date == null ) { return null; } return DateTimeFormatter.ISO_INSTANT.format( date.toInstant() ); }
Handles Date as a character data on the database @author Steve Ebersole
convertToDatabaseColumn
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/DateConverter.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/DateConverter.java
Apache-2.0
@Override public Date convertToEntityAttribute(String date) { if ( StringHelper.isEmpty( date ) ) { return null; } return Date.from( Instant.from( DateTimeFormatter.ISO_INSTANT.parse( date ) ) ); }
Handles Date as a character data on the database @author Steve Ebersole
convertToEntityAttribute
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/DateConverter.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/DateConverter.java
Apache-2.0
@Test void verifyMetamodel(DomainModelScope scope) { scope.withHierarchy( TestEntity.class, (entity) -> { final Property theDateProperty = entity.getProperty( "theDate" ); assertThat( theDateProperty ).isNotNull(); assertThat( theDateProperty.isUpdateable() ).isTrue(); final BasicValue basicValue = (Bas...
Tests applying {@link Mutability} to an {@link jakarta.persistence.AttributeConverter}. Here we just verify that has the same effect as {@link Mutability} directly on the attribute in terms of configuring the boot model references. @see ImmutableConvertedBaselineTests @author Steve Ebersole
verifyMetamodel
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/ImmutabilityConverterTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/ImmutabilityConverterTests.java
Apache-2.0
public Integer getId() { return id; }
Tests applying {@link Mutability} to an {@link jakarta.persistence.AttributeConverter}. Here we just verify that has the same effect as {@link Mutability} directly on the attribute in terms of configuring the boot model references. @see ImmutableConvertedBaselineTests @author Steve Ebersole
getId
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/ImmutabilityConverterTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/ImmutabilityConverterTests.java
Apache-2.0
public String getName() { return name; }
Tests applying {@link Mutability} to an {@link jakarta.persistence.AttributeConverter}. Here we just verify that has the same effect as {@link Mutability} directly on the attribute in terms of configuring the boot model references. @see ImmutableConvertedBaselineTests @author Steve Ebersole
getName
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/ImmutabilityConverterTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/ImmutabilityConverterTests.java
Apache-2.0
public void setName(String name) { this.name = name; }
Tests applying {@link Mutability} to an {@link jakarta.persistence.AttributeConverter}. Here we just verify that has the same effect as {@link Mutability} directly on the attribute in terms of configuring the boot model references. @see ImmutableConvertedBaselineTests @author Steve Ebersole
setName
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/ImmutabilityConverterTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/ImmutabilityConverterTests.java
Apache-2.0
@Test void verifyDomainModel(DomainModelScope domainModelScope, SessionFactoryScope sfSessionFactoryScope) { final PersistentClass persistentClass = domainModelScope.getEntityBinding( TheEntity.class ); final EntityPersister entityDescriptor = sfSessionFactoryScope .getSessionFactory() .getRuntimeMetamodel...
Essentially the same as {@link BasicAttributeMutabilityTests#verifyDomainModel}
verifyDomainModel
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/ImmutableConvertedBaselineTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/ImmutableConvertedBaselineTests.java
Apache-2.0
@Test void testImmutableManaged(SessionFactoryScope scope) { scope.inTransaction( (session) -> { session.persist( new TheEntity( 1, "@Immutable test", Date.from( START ) ) ); } ); // load a managed reference and mutate the date scope.inTransaction( (session) -> { final TheEntity theEntity = session.find...
Effectively the same as {@linkplain BasicAttributeMutabilityTests#testImmutableManaged} Because it is non-updateable, no UPDATE
testImmutableManaged
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/ImmutableConvertedBaselineTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/ImmutableConvertedBaselineTests.java
Apache-2.0
@Test void testImmutableMerge(SessionFactoryScope scope) { scope.inTransaction( (session) -> { session.persist( new TheEntity( 1, "@Immutable test", Date.from( START ) ) ); } ); // load a detached reference final TheEntity detached = scope.fromTransaction( (session) -> session.find( TheEntity.class, 1 ) );...
Effectively the same as {@linkplain BasicAttributeMutabilityTests#testImmutableDetached} Because it is non-updateable, no UPDATE
testImmutableMerge
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/ImmutableConvertedBaselineTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/ImmutableConvertedBaselineTests.java
Apache-2.0
@Test void testImmutabilityManaged(SessionFactoryScope scope) { scope.inTransaction( (session) -> { session.persist( new TheEntity( 1, "@Mutability test", Date.from( START ) ) ); } ); // try to update the managed form scope.inTransaction( (session) -> { final TheEntity theEntity = session.find( TheEntit...
Effectively the same as {@linkplain BasicAttributeMutabilityTests#testImmutabilityManaged}. Because the state mutation is done on a managed instance, Hibernate detects that; and because it is internal-state-immutable, we will ignore the mutation and there will be no UPDATE
testImmutabilityManaged
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/ImmutableConvertedBaselineTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/ImmutableConvertedBaselineTests.java
Apache-2.0
@Test void testImmutabilityDetached(SessionFactoryScope scope) { scope.inTransaction( (session) -> { session.persist( new TheEntity( 1, "@Mutability test", Date.from( START ) ) ); } ); // load a detached reference final TheEntity detached = scope.fromTransaction( (session) -> session.find( TheEntity.class,...
Effectively the same as {@linkplain BasicAttributeMutabilityTests#testImmutabilityDetached} There will be an UPDATE because we cannot distinguish one type of change from another while detached
testImmutabilityDetached
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/ImmutableConvertedBaselineTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/ImmutableConvertedBaselineTests.java
Apache-2.0
@AfterEach void dropTestData(SessionFactoryScope scope) { scope.inTransaction( (session) -> session.createMutationQuery( "delete TheEntity" ).executeUpdate() ); }
Effectively the same as {@linkplain BasicAttributeMutabilityTests#testImmutabilityDetached} There will be an UPDATE because we cannot distinguish one type of change from another while detached
dropTestData
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/ImmutableConvertedBaselineTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/ImmutableConvertedBaselineTests.java
Apache-2.0
@Test void verifyMetamodel(DomainModelScope scope) { scope.withHierarchy( TestEntity.class, (entity) -> { { final Property property = entity.getProperty( "mutableDate" ); assertThat( property ).isNotNull(); assertThat( property.isUpdateable() ).isTrue(); final BasicValue basicValue = (BasicValue)...
Tests applying {@link Immutable} to an {@link jakarta.persistence.AttributeConverter}. Here we just verify that has the same effect as {@link Immutable} directly on the attribute in terms of configuring the boot model references. @see ImmutableConvertedBaselineTests @author Steve Ebersole
verifyMetamodel
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/ImmutableConverterTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/ImmutableConverterTests.java
Apache-2.0
public Integer getId() { return id; }
Tests applying {@link Immutable} to an {@link jakarta.persistence.AttributeConverter}. Here we just verify that has the same effect as {@link Immutable} directly on the attribute in terms of configuring the boot model references. @see ImmutableConvertedBaselineTests @author Steve Ebersole
getId
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/ImmutableConverterTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/ImmutableConverterTests.java
Apache-2.0
public String getName() { return name; }
Tests applying {@link Immutable} to an {@link jakarta.persistence.AttributeConverter}. Here we just verify that has the same effect as {@link Immutable} directly on the attribute in terms of configuring the boot model references. @see ImmutableConvertedBaselineTests @author Steve Ebersole
getName
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/ImmutableConverterTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/ImmutableConverterTests.java
Apache-2.0
public void setName(String name) { this.name = name; }
Tests applying {@link Immutable} to an {@link jakarta.persistence.AttributeConverter}. Here we just verify that has the same effect as {@link Immutable} directly on the attribute in terms of configuring the boot model references. @see ImmutableConvertedBaselineTests @author Steve Ebersole
setName
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/ImmutableConverterTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/mutability/converted/ImmutableConverterTests.java
Apache-2.0
private static Map<String, String> toMap(String... values) { assert values.length % 2 == 0; final HashMap<String,String> valuesMap = new HashMap<>(); for ( int i = 0; i < values.length; i += 2 ) { valuesMap.put( values[i], values[i+1] ); } return valuesMap; }
Tests for composite (multiple attributes) natural-ids
toMap
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
Apache-2.0
@BeforeEach public void prepareTestData(SessionFactoryScope scope) { scope.inTransaction( session -> { session.persist( new Account( 1, "neo", "matrix", "neo@nebuchadnezzar.zion.net" ) ); session.persist( new Account( 2, "trinity", "matrix", "trin@nebuchadnezzar.zion.net" ) ); } ); }
Tests for composite (multiple attributes) natural-ids
prepareTestData
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
Apache-2.0
@AfterEach public void releaseTestData(SessionFactoryScope scope) { scope.inTransaction( session -> { session.createQuery( "delete Account" ).executeUpdate(); } ); }
Tests for composite (multiple attributes) natural-ids
releaseTestData
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
Apache-2.0
@Test public void testProcessing(DomainModelScope domainModelScope, SessionFactoryScope factoryScope) { final PersistentClass accountBootMapping = domainModelScope.getDomainModel().getEntityBinding( Account.class.getName() ); assertThat( accountBootMapping.hasNaturalId(), is( true ) ); final Property username = ...
Tests for composite (multiple attributes) natural-ids
testProcessing
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
Apache-2.0
@Test public void testGetReference(SessionFactoryScope scope) { scope.inTransaction( session -> { final NaturalIdLoadAccess<Account> loadAccess = session.byNaturalId( Account.class ); loadAccess.using( "system", "matrix" ); loadAccess.using( "username", "neo" ); verifyEntity( loadAccess.getRe...
Tests for composite (multiple attributes) natural-ids
testGetReference
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
Apache-2.0
public void verifyEntity(Account accountRef) { assertThat( accountRef, notNullValue() ); assertThat( accountRef.getId(), is( 1 ) ); assertThat( accountRef.getSystem(), is( "matrix" ) ); assertThat( accountRef.getUsername(), is( "neo" ) ); }
Tests for composite (multiple attributes) natural-ids
verifyEntity
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
Apache-2.0
@Test public void testLoad(SessionFactoryScope scope) { scope.inTransaction( session -> { final Account account = session.byNaturalId( Account.class ) .using( "system", "matrix" ) .using( "username", "neo" ) .load(); verifyEntity( account ); } ); scope.inTransaction( s...
Tests for composite (multiple attributes) natural-ids
testLoad
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
Apache-2.0
@Test public void testOptionalLoad(SessionFactoryScope scope) { scope.inTransaction( session -> { final NaturalIdLoadAccess<Account> loadAccess = session.byNaturalId( Account.class ); final Optional<Account> optionalAccount = loadAccess .using( "system", "matrix" ) .using( "username", "ne...
Tests for composite (multiple attributes) natural-ids
testOptionalLoad
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
Apache-2.0
@Test public void testMultiLoad(SessionFactoryScope scope) { scope.inTransaction( session -> { final NaturalIdMultiLoadAccess<Account> loadAccess = session.byMultipleNaturalId( Account.class ); loadAccess.enableOrderedReturn( false ); final List<Account> accounts = loadAccess.multiLoad( Map...
Tests for composite (multiple attributes) natural-ids
testMultiLoad
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
Apache-2.0
public Integer getId() { return id; }
Tests for composite (multiple attributes) natural-ids
getId
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
Apache-2.0
public void setId(Integer id) { this.id = id; }
Tests for composite (multiple attributes) natural-ids
setId
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
Apache-2.0
public String getUsername() { return username; }
Tests for composite (multiple attributes) natural-ids
getUsername
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
Apache-2.0
public void setUsername(String username) { this.username = username; }
Tests for composite (multiple attributes) natural-ids
setUsername
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
Apache-2.0
public String getSystem() { return system; }
Tests for composite (multiple attributes) natural-ids
getSystem
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
Apache-2.0
public void setSystem(String system) { this.system = system; }
Tests for composite (multiple attributes) natural-ids
setSystem
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
Apache-2.0
public String getEmailAddress() { return emailAddress; }
Tests for composite (multiple attributes) natural-ids
getEmailAddress
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
Apache-2.0
public void setEmailAddress(String emailAddress) { this.emailAddress = emailAddress; }
Tests for composite (multiple attributes) natural-ids
setEmailAddress
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/CompoundNaturalIdTests.java
Apache-2.0
@BeforeEach public void prepareTestData(SessionFactoryScope scope) { scope.inTransaction( session -> { final Vendor vendor = new Vendor( 1, "Acme Brick", "Acme Global" ); session.persist( vendor ); final Product product = new Product( 1, uuid, vendor, Monetary.getDefau...
Tests for simple (single attribute) natural-ids
prepareTestData
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/SimpleNaturalIdTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/SimpleNaturalIdTests.java
Apache-2.0
@AfterEach public void releaseTestData(SessionFactoryScope scope) { scope.inTransaction( session -> { session.createQuery( "delete Product" ).executeUpdate(); session.createQuery( "delete Vendor" ).executeUpdate(); } ); }
Tests for simple (single attribute) natural-ids
releaseTestData
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/SimpleNaturalIdTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/SimpleNaturalIdTests.java
Apache-2.0
@Test public void testProcessing(DomainModelScope domainModelScope, SessionFactoryScope factoryScope) { final PersistentClass productBootMapping = domainModelScope.getDomainModel().getEntityBinding( Product.class.getName() ); assertThat( productBootMapping.hasNaturalId(), is( true ) ); final Property sku = produ...
Tests for simple (single attribute) natural-ids
testProcessing
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/SimpleNaturalIdTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/SimpleNaturalIdTests.java
Apache-2.0
@Test public void testGetReference(SessionFactoryScope scope) { scope.inTransaction( session -> { final SimpleNaturalIdLoadAccess<Product> loadAccess = session.bySimpleNaturalId( Product.class ); verifyEntity( loadAccess.getReference( uuid ) ); } ); }
Tests for simple (single attribute) natural-ids
testGetReference
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/SimpleNaturalIdTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/SimpleNaturalIdTests.java
Apache-2.0
public void verifyEntity(Product productRef) { assertThat( productRef, notNullValue() ); assertThat( productRef.getId(), is( 1 ) ); assertThat( productRef.getSku(), is( uuid ) ); }
Tests for simple (single attribute) natural-ids
verifyEntity
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/SimpleNaturalIdTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/SimpleNaturalIdTests.java
Apache-2.0
@Test public void testLoad(SessionFactoryScope scope) { scope.inTransaction( session -> { final SimpleNaturalIdLoadAccess<Product> loadAccess = session.bySimpleNaturalId( Product.class ); verifyEntity( loadAccess.load( uuid ) ); } ); }
Tests for simple (single attribute) natural-ids
testLoad
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/SimpleNaturalIdTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/SimpleNaturalIdTests.java
Apache-2.0
@Test public void testOptionalLoad(SessionFactoryScope scope) { scope.inTransaction( session -> { final SimpleNaturalIdLoadAccess<Product> loadAccess = session.bySimpleNaturalId( Product.class ); final Optional<Product> optionalProduct = loadAccess.loadOptional( uuid ); assertThat( optionalProduct...
Tests for simple (single attribute) natural-ids
testOptionalLoad
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/SimpleNaturalIdTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/SimpleNaturalIdTests.java
Apache-2.0
@Test public void testMultiLoad(SessionFactoryScope scope) { scope.inTransaction( session -> { final NaturalIdMultiLoadAccess<Product> loadAccess = session.byMultipleNaturalId( Product.class ); loadAccess.enableOrderedReturn( false ); final List<Product> products = loadAccess.multiLoad( uuid ); ...
Tests for simple (single attribute) natural-ids
testMultiLoad
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/SimpleNaturalIdTests.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/SimpleNaturalIdTests.java
Apache-2.0
@BeforeEach public void createTestData(SessionFactoryScope scope) { final SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); final StatisticsImplementor stats = sessionFactory.getStatistics(); sessionFactory.getCache().evictAllRegions(); stats.clear(); scope.inTransaction( (session) ...
Test case for NaturalId annotation on an {@link Immutable} entity @author Eric Dalquist
createTestData
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/immutableentity/ImmutableEntityNaturalIdTest.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/immutableentity/ImmutableEntityNaturalIdTest.java
Apache-2.0
@AfterEach public void dropTestData(SessionFactoryScope scope) { scope.inTransaction( (session) -> session.createQuery( "delete Building" ).executeUpdate() ); }
Test case for NaturalId annotation on an {@link Immutable} entity @author Eric Dalquist
dropTestData
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/immutableentity/ImmutableEntityNaturalIdTest.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/immutableentity/ImmutableEntityNaturalIdTest.java
Apache-2.0
@Test public void testNaturalIdMapping(SessionFactoryScope scope) { final EntityMappingType buildingMapping = scope.getSessionFactory() .getRuntimeMetamodels() .getEntityMappingType( Building.class ); final NaturalIdMapping naturalIdMapping = buildingMapping.getNaturalIdMapping(); assertThat( naturalIdM...
Test case for NaturalId annotation on an {@link Immutable} entity @author Eric Dalquist
testNaturalIdMapping
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/immutableentity/ImmutableEntityNaturalIdTest.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/immutableentity/ImmutableEntityNaturalIdTest.java
Apache-2.0
@Test public void testImmutableNaturalIdLifecycle(SessionFactoryScope scope) { final SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); final StatisticsImplementor stats = sessionFactory.getStatistics(); // Clear caches and reset cache stats sessionFactory.getCache().evictNaturalIdData(); ...
Test case for NaturalId annotation on an {@link Immutable} entity @author Eric Dalquist
testImmutableNaturalIdLifecycle
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/immutableentity/ImmutableEntityNaturalIdTest.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/immutableentity/ImmutableEntityNaturalIdTest.java
Apache-2.0
@Test @JiraKey( value = "HHH-7371" ) public void testImmutableNaturalIdLifecycle2(SessionFactoryScope scope) { scope.inTransaction( (s) -> { final NaturalIdLoadAccess<Building> naturalIdLoader = s.byNaturalId( Building.class ); naturalIdLoader .using( "address", "1210 W. Dayton St." ) .u...
Test case for NaturalId annotation on an {@link Immutable} entity @author Eric Dalquist
testImmutableNaturalIdLifecycle2
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/immutableentity/ImmutableEntityNaturalIdTest.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/immutableentity/ImmutableEntityNaturalIdTest.java
Apache-2.0
@Id @GeneratedValue( generator = "increment" ) @GenericGenerator( name = "increment", strategy = "increment" ) public Long getId() { return id; }
@author Emanuel Kupcik @author Steve Ebersole
getId
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/inheritance/Principal.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/inheritance/Principal.java
Apache-2.0
public void setId(Long id) { this.id = id; }
@author Emanuel Kupcik @author Steve Ebersole
setId
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/inheritance/Principal.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/inheritance/Principal.java
Apache-2.0
@NaturalId(mutable=true) @Column(name = "P_UID") public String getUid() { return uid; }
@author Emanuel Kupcik @author Steve Ebersole
getUid
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/inheritance/Principal.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/inheritance/Principal.java
Apache-2.0
public void setUid(String uid) { this.uid = uid; }
@author Emanuel Kupcik @author Steve Ebersole
setUid
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/inheritance/Principal.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/inheritance/Principal.java
Apache-2.0
@Id @GeneratedValue( generator = "increment" ) @GenericGenerator( name = "increment", strategy = "increment" ) public Integer getId() { return id; }
@author Guenther Demetz Same as Another.class, excpect that here also the entity class itself is configured for shared cache
getId
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/mutable/cached/AllCached.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/mutable/cached/AllCached.java
Apache-2.0
public void setId(Integer id) { this.id = id; }
@author Guenther Demetz Same as Another.class, excpect that here also the entity class itself is configured for shared cache
setId
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/mutable/cached/AllCached.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/mutable/cached/AllCached.java
Apache-2.0
@NaturalId(mutable = true) public String getName() { return name; }
@author Guenther Demetz Same as Another.class, excpect that here also the entity class itself is configured for shared cache
getName
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/mutable/cached/AllCached.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/mutable/cached/AllCached.java
Apache-2.0
public void setName(String name) { this.name = name; }
@author Guenther Demetz Same as Another.class, excpect that here also the entity class itself is configured for shared cache
setName
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/mutable/cached/AllCached.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/mutable/cached/AllCached.java
Apache-2.0
@AfterEach public void dropTestData(SessionFactoryScope scope) { scope.inTransaction( (session) -> { session.createMutationQuery( "delete from Another" ).executeUpdate(); session.createMutationQuery( "delete from AllCached" ).executeUpdate(); session.createMutationQuery( "delete from SubClass" ).e...
Tests of mutable natural ids stored in second level cache @author Guenther Demetz @author Steve Ebersole
dropTestData
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/mutable/cached/CachedMutableNaturalIdTest.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/mutable/cached/CachedMutableNaturalIdTest.java
Apache-2.0
@Test public void testNaturalIdChangedWhileAttached(SessionFactoryScope scope) { scope.inTransaction( (session) -> session.persist( new Another( "it" ) ) ); scope.inTransaction( (session) -> { Another it = session.bySimpleNaturalId( Another.class ).load( "it" ); assertNotNull( it ); // ch...
Tests of mutable natural ids stored in second level cache @author Guenther Demetz @author Steve Ebersole
testNaturalIdChangedWhileAttached
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/mutable/cached/CachedMutableNaturalIdTest.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/mutable/cached/CachedMutableNaturalIdTest.java
Apache-2.0
@Test public void testNaturalIdChangedWhileDetached(SessionFactoryScope scope) { scope.inTransaction( (session) -> session.persist( new Another( "it" ) ) ); final Another detached = scope.fromTransaction( (session) -> { final Another it = session.bySimpleNaturalId( Another.class ).load( "it" ); ...
Tests of mutable natural ids stored in second level cache @author Guenther Demetz @author Steve Ebersole
testNaturalIdChangedWhileDetached
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/mutable/cached/CachedMutableNaturalIdTest.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/mutable/cached/CachedMutableNaturalIdTest.java
Apache-2.0
@Test public void testNaturalIdReCachingWhenNeeded(SessionFactoryScope scope) { final StatisticsImplementor statistics = scope.getSessionFactory().getStatistics(); statistics.clear(); final Integer id = scope.fromTransaction( (session) -> { Another it = new Another( "it" ); session.persist( it ); ...
Tests of mutable natural ids stored in second level cache @author Guenther Demetz @author Steve Ebersole
testNaturalIdReCachingWhenNeeded
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/mutable/cached/CachedMutableNaturalIdTest.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/mutable/cached/CachedMutableNaturalIdTest.java
Apache-2.0
@Test @JiraKey( "HHH-7245" ) public void testNaturalIdChangeAfterResolveEntityFrom2LCache(SessionFactoryScope scope) { final Integer id = scope.fromTransaction( (session) -> { AllCached it = new AllCached( "it" ); session.persist( it ); return it.getId(); } ); scope.inTransaction( (...
Tests of mutable natural ids stored in second level cache @author Guenther Demetz @author Steve Ebersole
testNaturalIdChangeAfterResolveEntityFrom2LCache
java
hibernate/hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/mutable/cached/CachedMutableNaturalIdTest.java
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/naturalid/mutable/cached/CachedMutableNaturalIdTest.java
Apache-2.0