Rohit
Rohit

Reputation: 363

Leaving Audit information from Entity JPA

I have a table that has audit information in the same table.

I want to create entity without the audit columns.

Is it possible in JPA.

e.g Person Table columns: name, address, (audit information)insertTime, (audit information)loggedUser

Can I create entity using only non audit information.

Please help

Upvotes: 0

Views: 327

Answers (2)

jeha
jeha

Reputation: 10700

As Matt Handy already said, the answer is yes. This feature can also be used to tailoring database views to specific entities.

On the other hand you now can't let the table be automatically created (e.g. when using Hibernate by setting hibernate.hbm2ddl.auto=create-drop) and so have to manage your schema yourself (which is no bad thing).

Upvotes: 1

Matt Handy
Matt Handy

Reputation: 30025

If I understand your question right, the answer is yes: You can create an JPA entity and don't need to map all columns of your database table in the entity class.

Upvotes: 3

Related Questions