Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #7655
| From | markspace <-@.> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Persistence API - magic? |
| Date | 2011-09-06 17:47 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <j46ev4$fpo$1@dont-email.me> (permalink) |
| References | <7e3a3be9-8960-4b94-8028-2da962435fc8@u6g2000yqa.googlegroups.com> |
On 9/6/2011 3:52 PM, nroberts wrote:
> One tutorial on persistence that I found (
> http://www.javaworld.com/javaworld/jw-01-2008/jw-01-jpa1.html?page=3 )
> explains how to make them by hand but it uses an orm.xml or
> annotations to tell Java what table and what columns to connect an
> entity object with. The eclipse stuff doesn't seem to do that at
> all. The orm.xml file exists, but it's practically empty containing
> nothing but the root element and xml tag.
I'm actually working on learning some JPA/JSF stuff right now too. The
orm.xml stuff confuses me because I haven't seen it before. I'm used to
a persistence.xml file being used. I'm concerned about versions here
and portability, because you seem to be configuring the tool directly,
and not using the JPA config file.
Does anyone know what this config file is about? What version of the
library uses it? It either seems specific to his library, and therefore
non-portable, or it's really old.
> 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.
> COUNTRY_ID comes between ID
> and CODE. The names are close but the case is different and the
> "country" column is actually COUNTRY_ID.
@Entity
public class MyClass {
@Id
int id;
@Column( name="COUNTRY_ID" )
String country;
...
}
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
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