All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.greenpepper.server.domain.AbstractUniqueEntity Maven / Gradle / Ivy

There is a newer version: 4.2.4
Show newest version
package com.greenpepper.server.domain;

import java.util.UUID;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.MappedSuperclass;

@MappedSuperclass
/**
 * 

Abstract AbstractUniqueEntity class.

* * @author oaouattara * @version $Id: $Id */ public abstract class AbstractUniqueEntity extends AbstractVersionedEntity { protected String uuid; /** *

Constructor for AbstractUniqueEntity.

*/ public AbstractUniqueEntity() { uuid = UUID.randomUUID().toString(); } /** *

getUUID.

* * @return a {@link java.lang.String} object. */ @Basic @Column(name="UUID", nullable = false) public String getUUID() { return this.uuid; } /** *

setUUID.

* * @param uuid a {@link java.lang.String} object. */ public void setUUID(String uuid) { this.uuid = uuid; } /** {@inheritDoc} */ public boolean equals(Object o) { return getUUID().equals(((AbstractUniqueEntity)o).getUUID()); } /** *

hashCode.

* * @return a int. */ public int hashCode() { return getUUID() == null ? 0 : getUUID().hashCode(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy