Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #7684
| From | markspace <-@.> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Persistence API - magic? |
| Date | 2011-09-07 09:15 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <j485b6$qe0$1@dont-email.me> (permalink) |
| References | <7e3a3be9-8960-4b94-8028-2da962435fc8@u6g2000yqa.googlegroups.com> <j46ev4$fpo$1@dont-email.me> <b1517a0a-2f5a-4695-9f5f-37b83b227032@en1g2000vbb.googlegroups.com> |
On 9/7/2011 8:10 AM, nroberts wrote:
> 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.
Actually, when I said "or," I meant that literally. Field names:
@Entity
public class Employee {
@Id
int id;
...
@Entity
@Access( AccessType.FIELD )
public class Employee { ...
Properties:
@Entity
public class Employee {
int id;
@Id
public int getId();
public void setId( int id );
...
}
@Entity
@Acces( AccessType.FIELD )
public class Employee {
@Id
int id;
@Access( AccessType.PROPERTY )
@Column( name="PHONE" )
protected String getPhoneForDb() {...}
protected void setPhoneForDb( String phone ) {...}
...
}
The last one is actually mixed and uses both fields and
accessors/mutators (properties).
>
> 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.
My implementation extends the DTO classes you define and adds methods
and such to them. It might be referring to a field or property it added
to your base class.
>
> I don't think I like the idea of relying on this behavior.
That's why there's overrides in the form of @Column(name=) and @Table(name=)
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