multiple POJOs/entities for the singletable

Viewed 3253

Does anyone know how I can create multiple POJOs/entities for the one table? Without getting the DuplicateEntitites error?

The reason I need multiple pojos is that I want to hide some properties in some cases.

Thank you for your time.

Updated: How I implemented Hrishikesh's suggestion.

@Entity(name="baseT1")
@Table(name="T1")
   public class BaseT1{
}

@Entity(name="T1")
@Table(name="T1")
   public class T1 extends BaseT1{
}

This gives me:

Invocation of init method failed; nested exception is     
org.hibernate.DuplicateMappingException: Duplicate table mapping T1

error.

5 Answers
Related