Tabnine Logo
ErraiSingularAttribute.getValueGenerator
Code IndexAdd Tabnine to your IDE (free)

How to use
getValueGenerator
method
in
org.jboss.errai.jpa.client.local.ErraiSingularAttribute

Best Java code snippets using org.jboss.errai.jpa.client.local.ErraiSingularAttribute.getValueGenerator (Showing top 2 results out of 315)

origin: errai/errai

/**
 * Generates a new ID value for the given entity instance that is guaranteed
 * to be unique <i>on this client</i>. If the entity instance with this ID is
 * ever synchronized to the server, this client-local ID will be replaced by a
 * permanent server-generated ID.
 * <p>
 * This method only works for attributes that are configured as
 * {@code @GeneratedValue}s. The GenerationType has no effect locally, but of
 * course it will come into play on the server side when and if the entity is
 * synchronized to the server.
 *
 * @param entityInstance
 *          the entity instance to receive the generated ID. This attribute of
 *          that entity instance will be set to the newly generated ID value.
 * @return the generated ID value, which has already been set on the entity
 *         instance.
 */
private <X, T> T generateAndSetLocalId(final X entityInstance, final ErraiSingularAttribute<X, T> attr) {
 final T nextId = attr.getValueGenerator().next(this);
 attr.set(entityInstance, nextId);
 return nextId;
}
origin: errai/errai

ErraiIdentifiableType<E> entityType = desiredStateEm.getMetamodel().entity(entityClass);
ErraiSingularAttribute<? super E, Object> idAttr = entityType.getId(Object.class);
ErraiIdGenerator<Object> idGenerator = idAttr.getValueGenerator();
if (idGenerator != null && idGenerator.hasNext(desiredStateEm)) {
 Object newLocalId = idGenerator.next(desiredStateEm);
org.jboss.errai.jpa.client.localErraiSingularAttributegetValueGenerator

Javadoc

Returns a generator for the values of this attribute. Only works for attributes that are annotated with @GeneratedValue.

Popular methods of ErraiSingularAttribute

  • get
  • set
  • getDeclaringType
  • getJavaType
  • isGeneratedValue
    Can the attribute's value be generated (usually for ID attributes).

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setScale (BigDecimal)
  • requestLocationUpdates (LocationManager)
  • setRequestProperty (URLConnection)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • Kernel (java.awt.image)
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • CodeWhisperer alternatives
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