org.hibernate.CallbackException Java Examples

The following examples show how to use org.hibernate.CallbackException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PredictionAccuracy.java    From core with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Callback due to implementing Lifecycle interface. Used to compact
 * string members by interning them.
 */
@Override
public void onLoad(Session s, Serializable id) throws CallbackException {
	if (routeId != null)
		routeId = routeId.intern();
	if (routeShortName != null)
		routeShortName = routeShortName.intern();
	if (directionId != null)
		directionId = directionId.intern();
	if (stopId != null)
		stopId = stopId.intern();
	if (tripId != null)
		tripId = tripId.intern();
	if (predictionSource != null)
		predictionSource = predictionSource.intern();
	if (vehicleId != null)
		vehicleId = vehicleId.intern();
}
 
Example #2
Source File: ArrivalDeparture.java    From core with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Callback due to implementing Lifecycle interface. Used to compact
 * string members by interning them.
 */
@Override
public void onLoad(Session s, Serializable id) throws CallbackException {
	if (vehicleId != null)
		vehicleId = vehicleId.intern();
	if (stopId != null)
		stopId = stopId.intern();
	if (tripId != null)
		tripId = tripId.intern();
	if (blockId != null)
		blockId = blockId.intern();
	if (routeId != null)
		routeId = routeId.intern();
	if (routeShortName != null)
		routeShortName = routeShortName.intern();
	if (serviceId != null)
		serviceId = serviceId.intern();
	if (directionId != null)
		directionId= directionId.intern();
}
 
Example #3
Source File: Trip.java    From core with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Callback due to implementing Lifecycle interface. Used to compact
 * string members by interning them.
 */
@Override
public void onLoad(Session s, Serializable id) throws CallbackException {
	if (tripId != null)
		tripId = tripId.intern();
	if (tripShortName != null)
		tripShortName = tripShortName.intern();
	if (directionId != null)
		directionId = directionId.intern();
	if (routeId != null)
		routeId = routeId.intern();
	if (routeShortName != null)
		routeShortName = routeShortName.intern();
	if (serviceId != null)
		serviceId = serviceId.intern();
	if (headsign != null)
		headsign = headsign.intern();
	if (blockId != null)
		blockId = blockId.intern();
	if (shapeId != null)
		shapeId = shapeId.intern();
}
 
Example #4
Source File: DocumentInterceptor.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public boolean onFlushDirty(Object entity, Serializable id,
		Object[] currentState, Object[] previousState,
		String[] propertyNames, Type[] types) throws CallbackException {
	if ( entity instanceof Document ) {
		currentState[2] = Calendar.getInstance();
		return true;
	}
	else {
		return false;
	}
}
 
Example #5
Source File: HibernateInterceptor.java    From onedev with MIT License 5 votes vote down vote up
@Override
public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames,
		Type[] types) throws CallbackException {
	boolean changed = false;
	for (PersistListener listener: listeners) {
		if (listener.onSave(entity, id, state, propertyNames, types))
			changed = true;
	}
	
	return changed;
}
 
Example #6
Source File: Match.java    From core with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Callback due to implementing Lifecycle interface. Used to compact
 * string members by interning them.
 */
@Override
public void onLoad(Session s, Serializable id) throws CallbackException {
	if (vehicleId != null)
		vehicleId = vehicleId.intern();
	if (tripId != null)
		tripId = tripId.intern();
	if (blockId != null)
		blockId = blockId.intern();
	if (serviceId != null)
		serviceId = serviceId.intern();
}
 
Example #7
Source File: HibernateInterceptor.java    From onedev with MIT License 5 votes vote down vote up
@Override
public boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames,
		Type[] types) throws CallbackException {
	boolean changed = false;
	for (PersistListener listener: listeners) {
		if (listener.onLoad(entity, id, state, propertyNames, types))
			changed = true;
	}
		
	return changed;
}
 
Example #8
Source File: HibernateInterceptor.java    From onedev with MIT License 5 votes vote down vote up
@Override
public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState,
		Object[] previousState, String[] propertyNames, Type[] types) throws CallbackException {
	boolean changed = false;
	for (PersistListener listener: listeners) {
		if (listener.onFlushDirty(entity, id, currentState, previousState, propertyNames, types))
			changed = true;
	}
		
	return changed;
}
 
Example #9
Source File: Qux.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public boolean onDelete(Session session) throws CallbackException {
	deleted=true;
	try {
		session.delete(foo);
	}
	catch (Exception e) {
		throw new CallbackException(e);
	}
	//if (child!=null) session.delete(child);
	return NO_VETO;
}
 
Example #10
Source File: Fum.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public boolean onSave(Session s) throws CallbackException {
	if (friends==null) return false;
	try {
		Iterator iter = friends.iterator();
		while ( iter.hasNext() ) {
			s.save( iter.next() );
		}
	}
	catch (Exception e) {
		throw new CallbackException(e);
	}
	return false;
}
 
Example #11
Source File: Qux.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public boolean onSave(Session session) throws CallbackException {
	created=true;
	try {
		foo = new Foo();
		session.save(foo);
	}
	catch (Exception e) {
		throw new CallbackException(e);
	}
	foo.setString("child of a qux");
	return NO_VETO;
}
 
Example #12
Source File: Foo.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public boolean onSave(Session db) throws CallbackException {
	_string = "a string";
	_date = new Date(123);
	_timestamp = new Date( System.currentTimeMillis() );
	_integer = new Integer( -666 );
	_long = new Long( 696969696969696969l - count++ );
	_short = new Short("42");
	_float = new Float( 6666.66f );
	//_double = new Double( 1.33e-69 );  // this double is too big for the sap db jdbc driver
	_double = new Double( 1.12e-36 );
	_boolean = new Boolean(true);
	_byte = new Byte( (byte) 127 );
	_int = 2;
	_char = '@';
	_bytes = _string.getBytes();
	Struct s = new Struct();
	s.name="name";
	s.count = 69;
	blob = s;
	binary = ( _string + "yada yada yada" ).getBytes();
	custom = new String[] { "foo", "bar" };
	component = new FooComponent("foo", 12, new Date[] { _date, _timestamp, null, new Date() }, new FooComponent("bar", 666, new Date[] { new Date(123456l), null }, null ) );
	component.setGlarch( new Glarch() );
	dependent = new Fee();
	dependent.setFi( "belongs to foo # " + getKey() );
	theLocale = Locale.getDefault();
	return NO_VETO;
}
 
Example #13
Source File: Glarch.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public boolean onSave(Session s) throws CallbackException {
	dynaBean = new HashMap();
	dynaBean.put("foo", "foo");
	dynaBean.put("bar", new Integer(66));
	immutable="never changes!";
	return NO_VETO;
}
 
Example #14
Source File: DocumentInterceptor.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public boolean onFlushDirty(
		Object entity, Serializable id,
		Object[] currentState, Object[] previousState,
		String[] propertyNames, Type[] types
) throws CallbackException {
	if ( entity instanceof Document ) {
		currentState[3] = Calendar.getInstance();
		return true;
	}
	else {
		return false;
	}
}
 
Example #15
Source File: DocumentInterceptor.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public boolean onSave(
		Object entity, Serializable id, Object[] state,
		String[] propertyNames, Type[] types
) throws CallbackException {
	if ( entity instanceof Document ) {
		state[4] = state[3] = Calendar.getInstance();
		return true;
	}
	else {
		return false;
	}
}
 
Example #16
Source File: TripPattern.java    From core with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean onUpdate(Session arg0) throws CallbackException {
	// Don't veto update
	return false;
}
 
Example #17
Source File: CustomInterceptorImpl.java    From tutorials with MIT License 4 votes vote down vote up
@Override
public Object instantiate(String entityName, EntityMode entityMode, Serializable id) throws CallbackException {
    // TODO Auto-generated method stub
    return null;
}
 
Example #18
Source File: PredictionAccuracy.java    From core with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Implemented due to Lifecycle interface being implemented. Not actually
 * used.
 */
@Override
public boolean onSave(Session s) throws CallbackException {
	return Lifecycle.NO_VETO;
}
 
Example #19
Source File: CustomInterceptorImpl.java    From tutorials with MIT License 4 votes vote down vote up
@Override
public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) throws CallbackException {
    // TODO Auto-generated method stub
    return false;
}
 
Example #20
Source File: Trip.java    From core with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Implemented due to Lifecycle interface being implemented. Not actually
 * used.
 */
@Override
public boolean onSave(Session s) throws CallbackException {
	return Lifecycle.NO_VETO;
}
 
Example #21
Source File: StopPath.java    From core with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean onUpdate(Session arg0) throws CallbackException {
	// Don't veto update
	return false;
}
 
Example #22
Source File: StopPath.java    From core with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean onSave(Session arg0) throws CallbackException {
	// Don't veto save
	return false;
}
 
Example #23
Source File: CustomInterceptorImpl.java    From tutorials with MIT License 4 votes vote down vote up
@Override
public void onCollectionUpdate(Object collection, Serializable key) throws CallbackException {
    // TODO Auto-generated method stub

}
 
Example #24
Source File: AuditInterceptor.java    From olat with Apache License 2.0 4 votes vote down vote up
@Override
public Object instantiate(String arg0, EntityMode arg1, Serializable arg2) throws CallbackException {
    // TODO Auto-generated method stub
    return null;
}
 
Example #25
Source File: AuditInterceptor.java    From olat with Apache License 2.0 4 votes vote down vote up
@Override
public Object instantiate(String arg0, EntityMode arg1, Serializable arg2) throws CallbackException {
    // TODO Auto-generated method stub
    return null;
}
 
Example #26
Source File: DocumentInterceptor.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public Object getEntity(String entityName, Serializable id)
		throws CallbackException {
	return null;
}
 
Example #27
Source File: CustomInterceptorImpl.java    From tutorials with MIT License 4 votes vote down vote up
@Override
public String getEntityName(Object object) throws CallbackException {
    // TODO Auto-generated method stub
    return null;
}
 
Example #28
Source File: DocumentInterceptor.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public Object instantiate(String entityName, EntityMode entityMode, Serializable id) throws CallbackException {
	return null;
}
 
Example #29
Source File: CustomInterceptorImpl.java    From tutorials with MIT License 4 votes vote down vote up
@Override
public void onCollectionRecreate(Object collection, Serializable key) throws CallbackException {
    // TODO Auto-generated method stub

}
 
Example #30
Source File: PredictionAccuracy.java    From core with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Implemented due to Lifecycle interface being implemented. Not actually
 * used.
 */
@Override
public boolean onUpdate(Session s) throws CallbackException {
	return Lifecycle.NO_VETO;
}