Session session = em.unwrap(Session.class); session.getDescriptor(Employee.class).getOptimisticLockingPolicy().getWriteLockValue(object, id, session);
field.setName(addUnderscores(field.getName())); for (DatabaseMapping attrMapping : session.getDescriptor(((AggregateObjectMapping) mapping).getReferenceClass()).getMappings()) { if (attrMapping.getAttributeName().equalsIgnoreCase((String) association.getKey())) { ((AggregateObjectMapping) mapping).addFieldTranslation(field, addUnderscores(attrMapping.getAttributeName()));
/** * Returns descriptor for given object. * * @param object * @return descriptor for given object */ public Descriptor getDescriptorForObject(Object object) { Session session = getSession(object); if (null != session && null != session.getDescriptor(object)) { return (Descriptor)session.getDescriptor(object); } return null; }
/** * Returns descriptor for given object. * * @param object * @return descriptor for given object */ public Descriptor getDescriptorForObject(Object object) { Session session = getSession(object); if (null != session && null != session.getDescriptor(object)) { return (Descriptor)session.getDescriptor(object); } return null; }
public Object convertObjectValueToDataValue(Object objectValue, Session session) { if(objectValue instanceof JAXBElement) { ClassDescriptor desc = session.getDescriptor(objectValue); if(desc == null || objectValue instanceof WrappedValue){ objectValue = ((JAXBElement)objectValue).getValue(); } } else if(objectValue instanceof Root) { objectValue = ((Root) objectValue).getObject(); } if(null != nestedConverter) { objectValue = nestedConverter.convertObjectValueToDataValue(objectValue, session); } return objectValue; }
public Object convertObjectValueToDataValue(Object objectValue, Session session) { if(objectValue instanceof JAXBElement) { ClassDescriptor desc = session.getDescriptor(objectValue); if(desc == null || objectValue instanceof WrappedValue){ objectValue = ((JAXBElement)objectValue).getValue(); } } else if(objectValue instanceof Root) { objectValue = ((Root) objectValue).getObject(); } if(null != nestedConverter) { objectValue = nestedConverter.convertObjectValueToDataValue(objectValue, session); } return objectValue; }
ClassDescriptor descriptor = getActiveSession().getDescriptor(cls);
XMLDescriptor xmlDescriptor = (XMLDescriptor) session.getDescriptor(object); StringTokenizer stringTokenizer = new StringTokenizer(xPath, "/"); setValueByXPath(object, xmlDescriptor.getObjectBuilder(), stringTokenizer, namespaceResolver, value);
public Object convertObjectValueToDataValue(Object objectValue, Session session, XMLMarshaller marshaller) { if(null != nestedConverter) { objectValue = nestedConverter.convertObjectValueToDataValue(objectValue, session, marshaller); } if(objectValue instanceof JAXBElement) { ClassDescriptor desc = session.getDescriptor(objectValue); if(desc == null || objectValue instanceof WrappedValue){ JAXBElement element = (JAXBElement) objectValue; Root root = new XMLRoot(); root.setLocalName(element.getName().getLocalPart()); root.setNamespaceURI(element.getName().getNamespaceURI()); root.setObject(element.getValue()); root.setDeclaredType(element.getDeclaredType()); root.setNil(element.isNil()); return root; } } return objectValue; }
@Override public Object convertObjectValueToDataValue(Object objectValue, Session session, XMLMarshaller marshaller) { if(null != nestedConverter) { objectValue = nestedConverter.convertObjectValueToDataValue(objectValue, session, marshaller); } if(objectValue instanceof JAXBElement) { ClassDescriptor desc = session.getDescriptor(objectValue); if(desc == null || objectValue instanceof WrappedValue){ JAXBElement element = (JAXBElement) objectValue; Root root = new XMLRoot(); root.setLocalName(element.getName().getLocalPart()); root.setNamespaceURI(element.getName().getNamespaceURI()); root.setObject(element.getValue()); root.setDeclaredType(element.getDeclaredType()); root.setNil(element.isNil()); return root; } } return objectValue; }
/** * Return the EclipseLink cache key object from the JPA Id object. */ private Object createPrimaryKeyFromId(Class cls, Object id) { Object cacheKey = null; ClassDescriptor aDescriptor = getSession().getDescriptor(cls); // Check that we have a descriptor associated with the class (Entity or MappedSuperclass) if(null == aDescriptor) { // No descriptor found, throw exception for Embeddable or non-persistable java class throw new IllegalArgumentException(ExceptionLocalization.buildMessage( "cache_impl_class_has_no_descriptor_is_not_a_persistent_type", new Object[] {cls})); } // The policy is not set if the mapping is natively defined outside of JPA if(aDescriptor.hasCMPPolicy()) { // we assume that the PK id parameter is correct and do not throw a cache_descriptor_has_no_cmppolicy_set_cannot_create_primary_key exception // The primaryKey may be the same object as the id parameter cacheKey = aDescriptor.getCMPPolicy().createPrimaryKeyFromId(id, getEntityManagerFactory().getDatabaseSession()); } return cacheKey; }
if (xrService.getOXSession().getDescriptor(ordtField.getType()) != null) { xrService.getXMLContext().createMarshaller().marshal(dr.get(field), rowElement); continue;
/** * This method will return the objects's Id. * If the descriptor associated with the domain object is null - an IllegalArgumentException is thrown. * If the CMPPolicy associated with the domain object's descriptor is null * the Id will be determined using the ObjectBuilder on the descriptor - which may return * the Id stored in the weaved _persistence_primaryKey field. * @See {@link JpaCache#getId(Object)} */ public Object getId(Object object) { getEntityManagerFactory().verifyOpen(); ClassDescriptor aDescriptor = getSession().getDescriptor(object.getClass()); // Handle a null descriptor from a detached entity (closed EntityManager), or the entity exists in another session if(null == aDescriptor) { throw new IllegalArgumentException(ExceptionLocalization.buildMessage( "cache_impl_object_has_no_descriptor_is_not_a_persistent_type", new Object[] {object})); } // Handle a null CMPPolicy from a MappedSuperclass if(!aDescriptor.hasCMPPolicy()) { // the following code gets the key either from the weaved _persistence_primaryKey field or using valueFromObject() if not bytecode enhanced return aDescriptor.getObjectBuilder().extractPrimaryKeyFromObject(object, (AbstractSession)getSession()); } else { // Get identifier via EMF return getEntityManagerFactory().getIdentifier(object); } }
if (xrService.getOXSession().getDescriptor(ordtField.getType()) != null) { xrService.getXMLContext().createMarshaller().marshal(dr.get(field), rowElement); continue;
if (row != null) { Session session = persistence.getEntityManager().getDelegate().unwrap(Session.class); ClassDescriptor descriptor = session.getDescriptor(entity); DatabaseMapping mapping = descriptor.getMappingForAttributeName(property); Vector<DatabaseField> fields = mapping.getFields();
XMLDescriptor xmlDescriptor = (XMLDescriptor) session.getDescriptor(object); StringTokenizer stringTokenizer = new StringTokenizer(xPath, "/"); T value = getValueByXPath(object, xmlDescriptor.getObjectBuilder(), stringTokenizer, namespaceResolver, returnType);
if (xrService.getORSession().getDescriptor(typeClass).isAggregateDescriptor()) { databaseQueryToInitialize = new DataReadQuery();
if (xrService.getORSession().getDescriptor(typeClass).isAggregateDescriptor()) { databaseQueryToInitialize = new DataReadQuery();
return true; XMLDescriptor descriptor = (XMLDescriptor) childSession.getDescriptor(objectValue); TreeObjectBuilder objectBuilder = (TreeObjectBuilder) descriptor.getObjectBuilder();