congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
ClassMetadata.setIdentifier
Code IndexAdd Tabnine to your IDE (free)

How to use
setIdentifier
method
in
org.hibernate.metadata.ClassMetadata

Best Java code snippets using org.hibernate.metadata.ClassMetadata.setIdentifier (Showing top 3 results out of 315)

origin: hibernate/hibernate-orm

/**
 * Inject the identifier value into the given entity.
 *
 * @param entity The entity to inject with the identifier value.
 * @param id The value to be injected as the identifier.
 * @param session The session from which is requests originates
 *
 * @deprecated Use {@link #setIdentifier(Object, Serializable, SharedSessionContractImplementor)} instead
 */
@Deprecated
default void setIdentifier(Object entity, Serializable id, SessionImplementor session) {
  setIdentifier( entity, id, (SharedSessionContractImplementor) session );
}
origin: com.atlassian.hibernate/hibernate.adapter

@Override
public void setIdentifier(final Object object, final Serializable id) throws HibernateException {
  metadata.setIdentifier(object, id, getSessionImplementor());
}
origin: org.nakedobjects/nos-objectstore-hibernate

public Object instantiate(final String entityName, final EntityMode entityMode, final Serializable id)
    throws CallbackException {
  if (LOG.isDebugEnabled()) {
    LOG.debug("instantiate entityName=" + entityName + ", id=" + id + ", mode=" + entityMode);
  }
  NakedObjectLoader loader = NakedObjectsContext.getObjectLoader();
  HibernateOid oid = new HibernateOid(entityName, id);
  NakedObjectSpecification spec = NakedObjectsContext.getReflector().loadSpecification(entityName);
  NakedObject adapter = loader.recreateAdapterForPersistent(oid, spec);
  // TODO fudge to work around problem in getEntity where entity is a subclass
  // (HibernateOid doesn't handle subclasses!)
  if (adapter.getResolveState().isResolved()) {
    loader.start(adapter, ResolveState.UPDATING);
  } else {
    loader.start(adapter, ResolveState.RESOLVING);
  }
  Object object = adapter.getObject();
  // need to set the id in case the object has an id property (if not id is held in
  // the oid, and that's taken care of above)
  try {
    HibernateUtil.getSessionFactory().getClassMetadata(entityName).setIdentifier(object, id, entityMode);
  } catch (HibernateException e) {
    throw new CallbackException("Error getting identifier property for class " + entityName, e);
  }
  return adapter.getObject();
}
org.hibernate.metadataClassMetadatasetIdentifier

Javadoc

Set the identifier of an instance (or do nothing if no identifier property)

Popular methods of ClassMetadata

  • getIdentifierPropertyName
    Get the name of the identifier property (or return null)
  • getIdentifierType
    Get the identifier Hibernate type
  • getEntityName
    The name of the entity
  • getPropertyNames
    Get the names of the class' persistent properties
  • getMappedClass
    The persistent class, or null
  • getIdentifier
  • getPropertyType
    Get the type of a particular (named) property
  • getPropertyTypes
    Get the Hibernate types of the class properties
  • getPropertyValue
    Get the value of a particular (named) property
  • getPropertyValues
    Extract the property values from the given entity.
  • hasIdentifierProperty
    Does this class have an identifier property?
  • setPropertyValue
    Set the value of a particular (named) property
  • hasIdentifierProperty,
  • setPropertyValue,
  • instantiate,
  • getVersionProperty,
  • getPropertyNullability,
  • getVersion,
  • isVersioned,
  • getNaturalIdentifierProperties,
  • getPropertyLaziness

Popular in Java

  • Reactive rest calls using spring rest template
  • addToBackStack (FragmentTransaction)
  • setScale (BigDecimal)
  • requestLocationUpdates (LocationManager)
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Path (java.nio.file)
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Collectors (java.util.stream)
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now