java - mapping superclasses and subclasses with hibernate (JPA) -


i trying persist objects in database using hibernate jpa.

the objects have type hierarchy, , i'm trying make work hibernate.

a catalogpackage object has important properties , getters. catalogpackageimpl (extends catalogpackage) object has no properties, of setters.

both classes non-abstract.

we want code refer catalogpackage objects. when initializing hibernate, complains setters missing catalogpackage class.

how suggest hibernate use subclass when building objects?

i don't want move setters superclass, , don't want use catalogpackageimpl entity.

even though can't see problem defining setter methods in catalogpackage since can marked private avoid using them external world. since didn't paste entities configuration , hibernate complaining setter methods can conclude using getters describe entity mapping, right?

in such case hibernate still complaining because assumes anything mapped database should done in both directions, if can read datastorage should allowed write in there.

so have either of below solutions:

  • add setters modifiers.
  • move mapping getter methods fields , set acces type field on top of entity:

    @access(accesstype.field) class catalogpackage {   ... } 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -