Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #1548

Re: MappedSuperClass annotation

From Lew <noone@lewscanon.com>
Newsgroups comp.lang.java.help
Subject Re: MappedSuperClass annotation
Date 2012-01-31 11:07 -0800
Organization albasani.net
Message-ID <jg9e58$13c$1@news.albasani.net> (permalink)
References (4 earlier) <UPeVq.4233$EF2.2547@newsfe18.iad> <jg41pd$b92$1@news.albasani.net> <d0rVq.5813$Au5.1538@newsfe23.iad> <jg6m78$suu$1@news.albasani.net> <DJPVq.5447$4K5.2311@newsfe16.iad>

Show all headers | View raw


Arved Sandstrom wrote:
> Lew wrote:
>> Daniel Pitts wrote:
>>> Lew wrote:
>>>> Can you share a snippet or example to illustrate that, please? I racked [sic]
>>>> my brain trying to figure out why you'd have > 1 level of '@MappedSuperClass'

... [SNIP] ...

>>> The basis is that I have a parent abstract class with universal
>>> metadata, then
>>> two other abstract classes with divergent metadata (different schemes
>>> for a
>>> similar workflow). Then my concrete classes extend one of those two
>>> mid-level
>>> classes.
>>>
>>> Not a common set up, but it is what was called for in my application.

>> That's sufficient to make the use case clear, thank you.
>>
>> The only universally applicable rule in programming is that there are no
>> universally applicable rules in programming.

... [SNIP] ...

> For maintenance/ongoing development reasons I'm personally not keen on
> using JPA @Inheritance, nor multiple levels of @Entity, nor do I use
> @MappedSuperclass for "substantive" fields (I'd prefer not to go the
> route of @AttributeOverride and @AssociationOverride either, to
> accommodate changes). As you might surmise I like relatively flat,
> uninspiring, and "safe" inheritance hierarchies for JPA.

JPA is best suited for flat, uninspiring, safe modeling overall; the trouble 
I've seen in its use comes from a combination of getting too fancy by half 
("sesquifancy") and using old-style, pre-JPA Hibernate, or trying to use it 
for bulk or set-oriented operations, or trying to do JDBC via JPA which is 
utterly stupid.  Sets and objects work differently!

Also, the mental model of 'EntityManager' is different from Hibernate's 
'Session'. People try to use it monolithically and discover problems like 
overfull entity management memory, for which they blame the framework instead 
of their own idiocy.

> But that's all personal choice. I'll have to admit that if a strong,
> reasoned argument were made for a case like Daniel's, that I wouldn't be
> able to reject this layered use of @MappedSuperclass out of hand.
> ...
> 1. By accessible I just mean that "real" DB auditing data is frequently
> harder to conveniently get at.

-- 
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg

Back to comp.lang.java.help | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

MappedSuperClass annotation Pidi <lamia@mail.com> - 2012-01-27 17:05 +0100
  Re: MappedSuperClass annotation Lew <noone@lewscanon.com> - 2012-01-27 10:50 -0800
    Re: MappedSuperClass annotation Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-01-27 12:50 -0800
      Re: MappedSuperClass annotation Lew <noone@lewscanon.com> - 2012-01-27 19:24 -0800
        Re: MappedSuperClass annotation Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-01-29 08:53 -0800
          Re: MappedSuperClass annotation Lew <noone@lewscanon.com> - 2012-01-29 10:05 -0800
            Re: MappedSuperClass annotation Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-01-29 22:45 -0800
              Re: MappedSuperClass annotation Lew <noone@lewscanon.com> - 2012-01-30 10:06 -0800
                Re: MappedSuperClass annotation Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-01-31 06:52 -0400
                Re: MappedSuperClass annotation Lew <noone@lewscanon.com> - 2012-01-31 11:07 -0800
      Re: MappedSuperClass annotation Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-01-28 12:02 -0400

csiph-web