I have a question regarding hibernate, I am learning it, Can we create pojos if there are database tables already present in db, and if any existing database table has 10 columns but I want only 5 fields in my Pojo, is it possible? can anybody elaborate
Asked
Active
Viewed 77 times
1 Answers
0
Basically yes, but you have to define an @Id (or equivalent) in any case. The other columns in table which you are not mapping should be NULLABLE or if not should have default value defined while persisting.
IMHO, This question looks similar to this
Can I have an entity that only maps to some columns of a table?

greengreyblue
- 389
- 3
- 12