Hibernate ORM TransientObjectException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Hibernate ORM TransientObjectException class.

This code example shows how to use the following methods:
This code example shows how to use the following methods:
		EntityEntry entry = source.getPersistenceContext().getEntry(entity);
		if (entry==null) {
			final EntityPersister persister = source.getEntityPersister( event.getEntityName(), entity );
			final Serializable id = persister.getIdentifier( entity, source );
			if ( !ForeignKeys.isNotTransient( event.getEntityName(), entity, Boolean.FALSE, source ) ) {
				throw new TransientObjectException(
						"cannot lock an unsaved transient instance: " + 
						persister.getEntityName()
				); 
			} 
 
			entry = reassociate(event, entity, id, persister);
			cascadeOnLock(event, persister, entity);
		} 
 
		upgradeLock( entity, entry, event.getLockOptions(), event.getSession() );
	} 
	 
	private void cascadeOnLock(LockEvent event, EntityPersister persister, Object entity) {
		EventSource source = event.getSession();
Full Snippet Info
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
			if ( id == null ) {
				// context-entity-identifier returns null explicitly if the entity 
				// is not associated with the persistence context; so make some 
				// deeper checks... 
				if ( isTransient(entityName, object, Boolean.FALSE, session) ) {
					throw new TransientObjectException(
							"object references an unsaved transient instance - save the transient instance before flushing: " + 
							(entityName == null ? session.guessEntityName( object ) : entityName)
					); 
				} 
				id = session.getEntityPersister( entityName, object ).getIdentifier( object, session );
			} 
			return id;
		} 
	} 
 
} 
Full Snippet Info
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
		return ( session != null && ! session.isClosed() );
	} 
 
	private void errorIfReadOnlySettingNotAvailable() { 
		if ( session == null ) {
			throw new TransientObjectException(
					"Proxy is detached (i.e, session is null). The read-only/modifiable setting is only accessible when the proxy is associated with an open session." ); 
		} 
		if ( session.isClosed() ) {
			throw new SessionException(
					"Session is closed. The read-only/modifiable setting is only accessible when the proxy is associated with an open session." ); 
		} 
	} 
 
	@Override 
	public final boolean isReadOnly() { 
		errorIfReadOnlySettingNotAvailable(); 
		return readOnly;
	} 
 
Full Snippet Info
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
			isReadOnly = ( ( HibernateProxy ) entityOrProxy ).getHibernateLazyInitializer().isReadOnly(); 
		} 
		else { 
			EntityEntry ee =  getEntry( entityOrProxy ); 
			if ( ee == null ) { 
				throw new TransientObjectException("Instance was not associated with this persistence context" ); 
			} 
			isReadOnly = ee.isReadOnly(); 
		} 
		return isReadOnly; 
	} 
 
	public void setReadOnly(Object object, boolean readOnly) { 
		if ( object == null ) { 
			throw new AssertionFailure( "object must be non-null." ); 
		} 
		if ( isReadOnly( object ) == readOnly ) { 
			return; 
		} 
		if ( object instanceof HibernateProxy ) { 
Full Snippet Info
1
CodeRank
Experience pair programming with AI  Get Codota for Java