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

org.jlot.hibernate.orm.PersistableEntity Maven / Gradle / Ivy

The newest version!
package org.jlot.hibernate.orm;

import java.io.Serializable;

import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;

@MappedSuperclass
public class PersistableEntity implements Serializable, Comparable
{
	private static final long	serialVersionUID	= 1L;
	@Id
	@GeneratedValue
	private Integer				id;

	public Integer getId ( )
	{
		return id;
	}

	public boolean isNew ( )
	{
		return getId() == null;
	}

	@Override
	public int compareTo ( PersistableEntity otherPersistableEntity )
	{
		return getId().compareTo(otherPersistableEntity.getId());
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy