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


Groups > comp.lang.java.programmer > #3573

Re: Hibernate

From Arved Sandstrom <asandstrom3minus1@eastlink.ca>
Newsgroups comp.lang.java.programmer
Subject Re: Hibernate
References <MPG.282a127c2a93232998972a@news.justthe.net> <sc9wp.8843$Du7.8665@newsfe04.iad> <alpine.DEB.2.00.1105042200451.10261@urchin.earth.li>
Message-ID <jpAwp.13794$ei6.2018@newsfe19.iad> (permalink)
Organization Public Usenet Newsgroup Access
Date 2011-05-05 13:39 -0300

Show all headers | View raw


On 11-05-04 07:13 PM, Tom Anderson wrote:
> On Wed, 4 May 2011, Arved Sandstrom wrote:
> 
>> On 11-05-03 06:24 PM, Steve Sobol wrote:
>>
>>> I've finally started using Hibernate again, after a long sabbatical.
>>> I really disliked having to declare each object in a separate XML
>>> file, and I am very happy that I now only need hibernate.cfg.xml and
>>> some annotations.
>>
>> Let me make one recommendation, Steve. Especially given that you have
>> used Hibernate before, and some time ago. Try not to use Hibernate
>> native APIs - stick to JPA. [...] With JPA 1.0 there were sizeable API
>> gaps that made forays into native ORM (Toplink, EclipseLink,
>> Hibernate, OpenJPA etc) APIs justifiable and somewhat common. But even
>> with JPA 1.0-compliant implementations you could do most of your work
>> with standard JPA. With JPA 2.0 it's much more comprehensive.
> 
> In my limited experience of it, it does seem that way.
> 
> There are still things missing, though. Do we have any idea what's going
> to be in JPA 3.0, or whatever the next significant feature release is
> going to be?
> 
> Off the top of my head, things i'd like to see (caveat - these might
> already be supported; there are many, many corners of JPA i don't know):

There are many, many corners of JPA *I* don't know, or have seldom used.
JPA 1.0 was already a good-sized spec, and JPA 2.0 added a lot.

> * A standardised way to add new type mappings (eg i'd like to be able to
> have a @Basic property of type Locale that gets stored as a varchar like
> "en_GB" rather than a BLOB of serialized data as now.
> 
> * Support for mapping properties of type SortedSet and SortedMap with
> @OrderBy (at the moment, AFAIK, it has to be a list, which is not really
> the right type, since if you're doing a normal mappedBy-type plural
> property, you can't actually have duplicates!).

Are you sure about that? That's not my understanding. The JPA API docs
for @OrderBy mention collections, not Lists. On a side note, I'll
mention that JPA 2.0 also introduced the @OrderColumn - there may be
some use cases you have that are well-served with this.

I am pretty sure I've used sorted sets before as an @OrderBy, but now
I'll have to try it and confirm.

> * An easier way of handling composite keys - i'd like to be able to do
> something like annotate multiple properties with @Id, and then use
> object arrays (or perhaps instances of Tuple) as keys. Similar to the
> situation with @IdClass now, but without having to write a class just to
> wrap the key.

Agreed. I stand to be corrected, but I don't think you can do this.

I'll have to digest the @Mapsid documentation before I comment, but I
think you're on the right track. It's hard to absorb all the different
things one can do now with composite keys in JPA 2.0.

AHS

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


Thread

Hibernate Steve Sobol <sjsobol@JustThe.net> - 2011-05-03 14:24 -0700
  Re: Hibernate Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-05-04 06:42 -0300
    Re: Hibernate Steve Sobol <sjsobol@JustThe.net> - 2011-05-04 13:19 -0700
    Re: Hibernate Tom Anderson <twic@urchin.earth.li> - 2011-05-04 23:13 +0100
      Re: Hibernate Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-05-05 13:39 -0300

csiph-web