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


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

Re: Hibernate foreign key as primary key

From Arved Sandstrom <asandstrom3minus1@eastlink.ca>
Newsgroups comp.lang.java.programmer
Subject Re: Hibernate foreign key as primary key
References (1 earlier) <9a7tq6FspmU1@mid.individual.net> <9a7vglFa7hU1@mid.individual.net> <4e3fb5d8@dnews.tpgi.com.au> <lwY%p.102448$eG6.101485@newsfe09.iad> <4e40f5a1@dnews.tpgi.com.au>
Message-ID <Swk0q.1410$fY3.47@newsfe07.iad> (permalink)
Organization Public Usenet Newsgroup Access
Date 2011-08-09 21:45 -0300

Show all headers | View raw


On 11-08-09 05:56 AM, Lionel wrote:
> On 09/08/11 07:26, Arved Sandstrom wrote:
>> On 11-08-08 07:11 AM, Lionel wrote:
>> [ SNIP ]
>>
>>> I thought there might be more knowledge of hibernate on this forum, but
>>> based on the responses it seems it is too specific for this forum. I
>>> just wasn't getting responses to other questions on the Hibernate forum
>>> (and neither were many other people though there are a high number of
>>> posts) so I decided to try on my preferred medium :).
>>>
>>> Thanks everyone for your input.
>>>
>>> Lionel.
>>
>> It's one thing if you're not getting Hibernate-specific answers here;
>> it's something else entirely if you (and a bunch of other folks) are not
>> getting answers on Hibernate forums.
>>
>> A suggestion I have is to consider the use of JPA. If you're happy with
>> Hibernate keep it as a JPA provider, but stick with the JPA 2
>> specification, and use annotations. XML configuration files are better
>> than straight text configuration files, by a long shot, but they are in
>> turn inferior to annotations; JPA radically cuts down on XML.
>>
>> The advantage of sticking with JPA is that it's the overall Java
>> persistence specification. You're no longer tied to a specific ORM.
>> There's also likely more people and more forums that can answer JPA
>> questions...including here. I stopped wasting my time with
>> Hibernate/Toplink mapping XML as soon as JPA 1.0 appeared.
> 
> I had wondered about JPA as I was starting with Hibernate. But I'm
> hesitant to back-pedal as this is a project with limited funding.
> 
> I actually prefer the XML mapping approach, the annotations add a lot of
> noise to what can otherwise be a clean model. It may be personal
> preference but I like the separation.
> 
> Does JPA provide the same features as Hibernate?

Well, if you're using Hibernate as the JPA persistence provider then the
features are identical. :-)

Seriously, though, the entire point of JPA has been to look at what
various Java ORMs have done, and to arrive at a standard that
incorporates the important and useful bits. Hibernate has informed the
JPA process quite a lot; especially with JPA 2 and provider
customization features I think you'll be hard-pressed to find something
you need to do that forces you to stray from JPA.

I haven't used Hibernate in a few years, but I expect that if necessary
you can do with it, in a JPA environment, what one can do with
EclipseLink; namely, retrieve references to native implementation
objects and use those if necessary.

> Can you easily
> configure any DBMS?

Yes. There is a reasonably standard way of doing so in JPA. Ultimately
as you might expect it still boils down to JDBC connection properties
and DataSources and what have you.

> Does it manage objects like Hibernate?

Yes. There are ORMs and then there are ORMs - some don't go much past
mapping and others are fully-fledged persistent object managers. JPA is
intended to support persistent object management, apart from mapping, so
native persistent object managers in Hibernate and EclipseLink, such as
sessions/units-of-work, translate fairly directly to the JPA entity manager.

[ SNIP ]

AHS

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


Thread

Hibernate foreign key as primary key Lionel <lionelv@none.com> - 2011-08-07 21:38 +1000
  Re: Hibernate foreign key as primary key markspace <-@.> - 2011-08-07 07:07 -0700
  Re: Hibernate foreign key as primary key Robert Klemme <shortcutter@googlemail.com> - 2011-08-07 18:03 +0200
  Re: Hibernate foreign key as primary key Frank Langelage <frank@lafr.de> - 2011-08-07 18:45 +0200
    Re: Hibernate foreign key as primary key Robert Klemme <shortcutter@googlemail.com> - 2011-08-07 19:14 +0200
      Re: Hibernate foreign key as primary key Lionel <lionelv@none.com> - 2011-08-08 20:11 +1000
        Re: Hibernate foreign key as primary key Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-08-08 18:26 -0300
          Re: Hibernate foreign key as primary key Lionel <lionelv@none.com> - 2011-08-09 18:56 +1000
            Re: Hibernate foreign key as primary key Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-08-09 21:45 -0300
        Re: Hibernate foreign key as primary key Lew <lewbloch@gmail.com> - 2011-08-10 09:58 -0700

csiph-web