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


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

Re: Persistence API - magic?

From nroberts <roberts.noah@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: Persistence API - magic?
Date 2011-09-07 08:10 -0700
Organization http://groups.google.com
Message-ID <b1517a0a-2f5a-4695-9f5f-37b83b227032@en1g2000vbb.googlegroups.com> (permalink)
References <7e3a3be9-8960-4b94-8028-2da962435fc8@u6g2000yqa.googlegroups.com> <j46ev4$fpo$1@dont-email.me>

Show all headers | View raw


On Sep 6, 5:47 pm, markspace <-@.> wrote:
> On 9/6/2011 3:52 PM, nroberts wrote:
> > I was thinking that perhaps it was order based, but the order of the
> > columns in the zip table to do not match.
>
> It's based on name, afaik.  The entity manager will strip off the "get"
> or "set" of your accessors/mutators, or it will use the field name, and
> look up a column of the same name.   Sometimes case doesn't matter (may
> depend on your database, i.e., it could be non-portable to rely on case
> insensitivity).  There's also ways of mapping from one column to an
> object property if the names are different.
>

It must be the field names because I just tried to change one but left
the getter/setter alone.  It exploded with a pile of exception vomit.

The country bit also blows up when you change the variable name.
Eclipse error specifically said, "join column kalifornia_id can not be
found."  The auto-name recognition thing must append _id to your
variable when you do a join.

I don't think I like the idea of relying on this behavior.  Will
probably never use it now that I have some understanding of what it's
doing.  Explicit annotations seem much more appropriate and
documenting, even if they're not strictly necessary in many cases.

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


Thread

Persistence API - magic? nroberts <roberts.noah@gmail.com> - 2011-09-06 15:52 -0700
  Re: Persistence API - magic? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-09-06 21:40 -0300
    Re: Persistence API - magic? nroberts <roberts.noah@gmail.com> - 2011-09-07 07:56 -0700
      Re: Persistence API - magic? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-09-07 17:34 -0300
  Re: Persistence API - magic? markspace <-@.> - 2011-09-06 17:47 -0700
    Re: Persistence API - magic? Lew <lewbloch@gmail.com> - 2011-09-06 18:26 -0700
      Re: Persistence API - magic? markspace <-@.> - 2011-09-06 19:01 -0700
    Re: Persistence API - magic? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-09-07 06:14 -0300
    Re: Persistence API - magic? nroberts <roberts.noah@gmail.com> - 2011-09-07 08:10 -0700
      Re: Persistence API - magic? markspace <-@.> - 2011-09-07 09:15 -0700
        Re: Persistence API - magic? Lew <lewbloch@gmail.com> - 2011-09-07 10:36 -0700
          Re: Persistence API - magic? markspace <-@.> - 2011-09-07 10:57 -0700
            Re: Persistence API - magic? Lew <lewbloch@gmail.com> - 2011-09-07 11:06 -0700
  Re: Persistence API - magic? Lew <lewbloch@gmail.com> - 2011-09-06 18:09 -0700
  Re: Persistence API - magic? Roedy Green <see_website@mindprod.com.invalid> - 2011-09-08 12:32 -0700
    Re: Persistence API - magic? "John B. Matthews" <nospam@nospam.invalid> - 2011-09-08 19:23 -0400

csiph-web