java - Querying Mapped Superclasses or Equivalent -


i have 3 classes subclasses of abstract superclass automobile. i'm using single table inheritance model , @mappedsuperclass automobile class. subclasses car, truck, , van.

i want query automobile class, have different subclasses returned. i've written couple queries , done research, seems not possible query against mappedsuperclasses. have tried nativesqlqueries, can't seem able figure out how specifiy multiple resultsetmappings.

is there anyway accomplish this?

you cannot use mapped-superclass in query. if want use automobile in query, don't mark mapped-superclass, instead mark entity.

following jpa 2.0 spec, second paragraph what's relevant in case -

2.11.2 mapped superclasses

an entity may inherit superclass provides persistent entity state , mapping information, not entity. typically, purpose of such mapped superclass define state , mapping information common multiple entity classes.

a mapped superclass, unlike entity, not queryable , must not passed argument entitymanager or query operations. persistent relationships defined mapped superclass must unidirectional.


Comments

Popular posts from this blog

My HTML document is not linking to my CSS stylesheet properly -

php array slice every 2th rule -

node.js - Sending sockets to client side, Error: Converting circular structure to JSON -