The specification has:
/**
* Return the id of the entity.
* A generated id is not guaranteed to be available until after * the database
insert has occurred.
* Returns null if the entity does not yet have an id.
* @param entity entity instance
* @return id of the entity
* @throws IllegalArgumentException if the
* to be an entity
*/
public Object getIdentifier(Object entity);
So, the only time it's supposed to return null is when the entity does not have
an id. Am I reading that correctly?
On Feb 19, 2013, at 2:45 PM, James Carman <[email protected]> wrote:
> I'm having an issue where the getIdentifier() method is returning null on an
> entity with the id set. I have a class like this:
>
> @MappedSuperclass
> public class UuidEntity
> {
> @Id
> private String id = UUID.randomUUID().toString();
>
> }
>
> My entities *always* have an id value. Shouldn't getIdentifier() always
> return the value of the "id" field?
>