0

Is there a way in JPA to do a Entity just be insertable? I mean, in any case, not just in a mapped column. In my case I am not allowed to put a trigger in DB. If I throw a Exception on PreUpdate. May it works?

CAN INSERT

Sertage
  • 3,123
  • 1
  • 19
  • 26
  • Do you mean an entity that: a) can not be updated _OR_ b) an entity that can not be updated and can not be read ? – Freiheit Apr 22 '15 at 14:36
  • a) can not be updated. It can be inserted and read. – Sertage Apr 22 '15 at 16:14
  • possible duplicate of [How to make an Entity read-only?](http://stackoverflow.com/questions/5115527/how-to-make-an-entity-read-only) – Freiheit Apr 22 '15 at 19:42
  • No, I want to make the insert. And put the fields protected won't protect the update/insert, reflection can be used. And it is not JPA solution. – Sertage Apr 22 '15 at 20:12
  • How about annotating fields with `@Column(updatable = false)` ? – wypieprz Apr 22 '15 at 20:42
  • Maybe, can I do that to a not entity column? This way I could annotate all the fields of the entity. – Sertage Apr 23 '15 at 11:10

0 Answers0