public Property getVersion() { return getSuperclass().getVersion(); }
public Property getVersion() { //get direct version or the one from the super mappedSuperclass // or the one from the super persistentClass Property propagatedVersion = version; if (propagatedVersion == null) { if ( superMappedSuperclass != null ) { propagatedVersion = superMappedSuperclass.getVersion(); } if (propagatedVersion == null && superPersistentClass != null){ propagatedVersion = superPersistentClass.getVersion(); } } return propagatedVersion; }
@Override public Comparator getOwnerVersionComparator() { if ( !isVersioned() ) { return null; } return ( (VersionType) collectionDescriptor.getOwner().getVersion().getType() ).getComparator(); }
private void assertTimestampSource(Class<?> clazz, Class<?> expectedTypeClass) throws Exception { PersistentClass persistentClass = metadata.getEntityBinding( clazz.getName() ); assertNotNull( persistentClass ); Property versionProperty = persistentClass.getVersion(); assertNotNull( versionProperty ); assertEquals( "Wrong timestamp type", expectedTypeClass, versionProperty.getType().getClass() ); } }
@SuppressWarnings("UnusedReturnValue") public Builder addEntityConfig(PersistentClass bootEntityDescriptor, AccessType accessType) { if ( entityConfigsByRootName == null ) { entityConfigsByRootName = new HashMap<>(); } // todo (5.3) : this is another place where having `BootstrapContext` / `TypeConfiguration` helps // would allow us to delay the attempt to resolve the comparator (usual timing issues wrt Type resolution) final NavigableRole rootEntityName = new NavigableRole( bootEntityDescriptor.getRootClass().getEntityName() ); final EntityDataCachingConfigImpl entityDataCachingConfig = entityConfigsByRootName.computeIfAbsent( rootEntityName, x -> new EntityDataCachingConfigImpl( rootEntityName, bootEntityDescriptor.isVersioned() ? (Supplier<Comparator>) () -> ( (VersionType) bootEntityDescriptor.getVersion().getType() ).getComparator() : null, bootEntityDescriptor.isMutable(), accessType ) ); if ( bootEntityDescriptor == bootEntityDescriptor.getRootClass() ) { entityDataCachingConfig.addCachedType( rootEntityName ); } else { entityDataCachingConfig.addCachedType( new NavigableRole( bootEntityDescriptor.getEntityName() ) ); } return this; }
versionColumnName = ( (Column) persistentClass.getVersion().getColumnIterator().next() ).getQuotedName( dialect );
if ( safeMapping.isVersioned() && property == safeMapping.getVersion() ) {
protected void validateCustomer(Metadata metadata) { final PersistentClass customerBinding = metadata.getEntityBinding( Customer.class.getName() ); assertNotNull( customerBinding ); validateCustomerPrimaryTableName( customerBinding.getTable().getQuotedName() ); assertEquals( 1, customerBinding.getIdentifier().getColumnSpan() ); validateCustomerPrimaryKeyColumn( (Column) customerBinding.getIdentifier().getColumnIterator().next() ); assertNotNull( customerBinding.getVersion() ); assertEquals( 1, customerBinding.getVersion().getColumnSpan() ); validateCustomerVersionColumn( (Column) customerBinding.getVersion().getColumnIterator().next() ); final Property nameBinding = customerBinding.getProperty( "name" ); assertNotNull( nameBinding ); assertEquals( 1, nameBinding.getColumnSpan() ); validateCustomerNameColumn( (Column) nameBinding.getColumnIterator().next() ); final Property hqAddressBinding = customerBinding.getProperty( "hqAddress" ); assertNotNull( hqAddressBinding ); assertEquals( 3, hqAddressBinding.getColumnSpan() ); validateCustomerHqAddressComponent( assertTyping( Component.class, hqAddressBinding.getValue() ) ); }
Property prop = ( Property ) iter.next(); if ( prop == persistentClass.getVersion() ) { tempVersionProperty = i; properties[i] = PropertyFactory.buildVersionProperty(
public Property getVersionProperty() { return clazz.getVersion(); }
public Property getVersionProperty() { return clazz.getVersion(); }
/** * @deprecated since 6.0, use {@link #getVersionAttributeMapping()}. */ @Deprecated @Override public Property getVersion() { return getSuperclass().getVersion(); }
public Property getVersion() { return getSuperclass().getVersion(); }
public Property getVersion() { //get direct version or the one from the super mappedSuperclass // or the one from the super persistentClass Property propagatedVersion = version; if (propagatedVersion == null) { if ( superMappedSuperclass != null ) { propagatedVersion = superMappedSuperclass.getVersion(); } if (propagatedVersion == null && superPersistentClass != null){ propagatedVersion = superPersistentClass.getVersion(); } } return propagatedVersion; }
public Property getVersion() { //get direct version or the one from the super mappedSuperclass // or the one from the super persistentClass Property propagatedVersion = version; if (propagatedVersion == null) { if ( superMappedSuperclass != null ) { propagatedVersion = superMappedSuperclass.getVersion(); } if (propagatedVersion == null && superPersistentClass != null){ propagatedVersion = superPersistentClass.getVersion(); } } return propagatedVersion; }
@Test public void testVersion() { PersistentClass cl = metadata.getEntityBinding("WithVersion"); Property version = cl.getVersion(); Assert.assertNotNull(version); Assert.assertEquals("version", version.getName()); cl = metadata.getEntityBinding("NoVersion"); Assert.assertNotNull(cl); version = cl.getVersion(); Assert.assertNull(version); }
public static CacheDataDescriptionImpl decode(PersistentClass model) { return new CacheDataDescriptionImpl( model.isMutable(), model.isVersioned(), model.isVersioned() ? ( ( VersionType ) model.getVersion().getType() ).getComparator() : null ); }
public static CacheDataDescriptionImpl decode(PersistentClass model) { return new CacheDataDescriptionImpl( model.isMutable(), model.isVersioned(), model.isVersioned() ? ( ( VersionType ) model.getVersion().getType() ).getComparator() : null ); }
public static CacheDataDescriptionImpl decode(Collection model) { return new CacheDataDescriptionImpl( model.isMutable(), model.getOwner().isVersioned(), model.getOwner().isVersioned() ? ( ( VersionType ) model.getOwner().getVersion().getType() ).getComparator() : null ); }
public static CacheDataDescriptionImpl decode(Collection model) { return new CacheDataDescriptionImpl( model.isMutable(), model.getOwner().isVersioned(), model.getOwner().isVersioned() ? ( ( VersionType ) model.getOwner().getVersion().getType() ).getComparator() : null ); }