[Minor] modified how objects are added to the ObjectFilter
Now objects are not added by their class names, but the type is retrieved from the object reference
This commit is contained in:
parent
f24a10992c
commit
59635eddf1
|
@ -58,7 +58,7 @@ public class ObjectDao {
|
|||
PersistenceContext<T> ctx = createCtx(object);
|
||||
ctx.setObject(object);
|
||||
ctx.getObjectRef().lock();
|
||||
this.objectFilter.add(object.getClass().getName(), ctx);
|
||||
this.objectFilter.add(ctx.getObjectRef().getType(), ctx);
|
||||
}
|
||||
|
||||
public <T> void addAll(List<T> objects) {
|
||||
|
@ -69,7 +69,7 @@ public class ObjectDao {
|
|||
PersistenceContext<T> ctx = createCtx(object);
|
||||
ctx.setObject(object);
|
||||
ctx.getObjectRef().lock();
|
||||
this.objectFilter.add(object.getClass().getName(), ctx);
|
||||
this.objectFilter.add(ctx.getObjectRef().getType(), ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public class ObjectDao {
|
|||
PersistenceContext<T> ctx = createCtx(object);
|
||||
ctx.setObject(object);
|
||||
ctx.getObjectRef().lock();
|
||||
this.objectFilter.update(object.getClass().getName(), ctx);
|
||||
this.objectFilter.update(ctx.getObjectRef().getType(), ctx);
|
||||
}
|
||||
|
||||
public <T> void updateAll(List<T> objects) {
|
||||
|
@ -91,7 +91,7 @@ public class ObjectDao {
|
|||
PersistenceContext<T> ctx = createCtx(object);
|
||||
ctx.setObject(object);
|
||||
ctx.getObjectRef().lock();
|
||||
this.objectFilter.update(object.getClass().getName(), ctx);
|
||||
this.objectFilter.update(ctx.getObjectRef().getType(), ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ public class ObjectDao {
|
|||
PersistenceContext<T> ctx = createCtx(object);
|
||||
ctx.setObject(object);
|
||||
ctx.getObjectRef().lock();
|
||||
this.objectFilter.remove(object.getClass().getName(), ctx);
|
||||
this.objectFilter.remove(ctx.getObjectRef().getType(), ctx);
|
||||
}
|
||||
|
||||
public <T> void removeAll(List<T> objects) {
|
||||
|
@ -113,7 +113,7 @@ public class ObjectDao {
|
|||
PersistenceContext<T> ctx = createCtx(object);
|
||||
ctx.setObject(object);
|
||||
ctx.getObjectRef().lock();
|
||||
this.objectFilter.remove(object.getClass().getName(), ctx);
|
||||
this.objectFilter.remove(ctx.getObjectRef().getType(), ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,8 +44,6 @@ public class PersistenceContextFactoryDelegator {
|
|||
|
||||
this.contextFactoryCacheByClass.put(classType, ctxFactory);
|
||||
this.contextFactoryCacheByType.put(type, ctxFactory);
|
||||
if (!classType.getName().equals(type))
|
||||
this.contextFactoryCacheByType.put(classType.getName(), ctxFactory);
|
||||
}
|
||||
|
||||
public <T> PersistenceContextFactory<T> getCtxFactory(Class<?> classType) {
|
||||
|
|
|
@ -21,15 +21,12 @@
|
|||
*/
|
||||
package ch.eitchnet.xmlpers.test.impl;
|
||||
|
||||
import ch.eitchnet.xmlpers.test.model.Book;
|
||||
import ch.eitchnet.xmlpers.test.model.Resource;
|
||||
|
||||
/**
|
||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||
*
|
||||
*/
|
||||
public class TestConstants {
|
||||
|
||||
public static final String TYPE_RES = Resource.class.getSimpleName();
|
||||
public static final String TYPE_BOOK = Book.class.getSimpleName();
|
||||
public static final String TYPE_RES = "Resource"; //$NON-NLS-1$
|
||||
public static final String TYPE_BOOK = "Book"; //$NON-NLS-1$
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue