119 words

final fields persistence

2017-09-13 20:10

(I already wrote the body here, but somehow it got lost; so I'm retrying; apologies if it appears twice.)


We love the idea of using ObjetDb, but 99% of our Java entities are immutable, and auto generated using https://immutables.github.io/ -- which creates final fields. Is there any way to support those in ObjectDb? (I've learned that, techincally, JPA does NOT prohibit final fields, though JDO might. And, Hibernate supports final fields (though most other JPA providers do not.) Thoughts?

gsaxena888's picture
Joined on 2017-09-13
User Post #1
2017-09-14 15:41

Final fields are transient in JPA/JDO by default.

Although persistent final fields are not supported by ObjectDB officially, it still may work if you specify specific final fields as persistent, using the @Persistent annotation (from JDO) or using the equivalent external XML persistence-modifier=persistent.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support's picture
Joined on 2010-05-03
User Post #2,813

Post Reply

Please read carefully the posting instructions - before posting to the ObjectDB website.

  • You may have to disable pop up blocking in order to use the toolbar (e.g. in Chrome).
  • Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell checker).
  • To insert formatted lines (e.g. Java code, stack trace) - select a style in the toolbar and then insert the text in the new created block.
  • Avoid overflow of published source code examples by breaking long lines.
  • You may mark in paragraph code words (e.g. class names) with the code style (can be applied by ctrl + D).
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.
Maximum file size: 32 MB