public class ReflectiveObjectPersister extends AbstractObjectPersister implements ObjectPersister
Limitations: the ReflectiveObjectPersister is NOT generic enough to persist anything you throw at it. It
makes assumptions about the objects that are true of most Confluence hibernate objects: including the presence
of an ID of type Long. Types that the reflective persister can not handle will need their own specific persister,
for example PropertySetItemPersister
.
Modifier and Type | Field and Description |
---|---|
static org.slf4j.Logger |
log |
persisterOperations, unsatisfiedObjectDependencies
Constructor and Description |
---|
ReflectiveObjectPersister(LabelManager labelManager,
ConfluenceUserDao confluenceUserDao,
StorageFormatUserRewriter storageFormatUserRewriter) |
Modifier and Type | Method and Description |
---|---|
List<TransientHibernateHandle> |
persist(ImportProcessorContext context,
ImportedObject importedObject)
Persist a given imported object.
|
static Object |
unproxyIfRequired(Object object)
When an object is retrieved from a Hibernate session, due to its lazy loading strategy, the object
is possibly a proxy object.
|
getPrimitivePropertyValue, getReferencePropertyValue
public ReflectiveObjectPersister(LabelManager labelManager, ConfluenceUserDao confluenceUserDao, StorageFormatUserRewriter storageFormatUserRewriter)
public List<TransientHibernateHandle> persist(ImportProcessorContext context, ImportedObject importedObject) throws Exception
ObjectPersister
persist
in interface ObjectPersister
context
- the context of the current import operationimportedObject
- the object to save.Exception
- if something goes wrong. To avoid duplication of "wrap everything in one exception type" code
in every persister, it is assumed wrapping happens at a higher level.public static Object unproxyIfRequired(Object object) throws net.sf.hibernate.HibernateException
ClassMetadata.setPropertyValue(Object target, String property, Object value)
is called but the target
object is a proxy object. Then, the new value
cannot be persisted to database.
This method aims to turn a proxy object to a real object so any update (if happens) can be persisted to database.object
- an object got from a Hibernate session, this object is either a real object or a proxy object.object
net.sf.hibernate.HibernateException
Copyright © 2003–2017 Atlassian. All rights reserved.