You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by Matthieu Riou <ma...@gmail.com> on 2007/01/15 17:45:07 UTC
Using _attributes
Hi,
We're using _attributes notations for instance attributes in Ode and I've
found slight problems with it in OpenJPA. If you use this notation the
default column names chosen by OpenJPA will start with _ which forces you to
use @Column and @ElementJoinColumn (unfortunately OpenJPA specific) all over
the place to have it work on some databases (at least Derby).
I think it could be nicer and a bit easier if OpenJPA was automatically
eliminating the first _ from attribute names to build its default coumn
names, don't you think?
Thanks,
Matthieu
Re: Using _attributes
Posted by Bryan Noll <bw...@gmail.com>.
I don't feel pre-fixing with '_' for member level attributes is really
necessary, particularly if you're using an IDE. I can see how it would
help someone using only vi or emacs recognize what was what, but with
the color code and hotkeys and quick-clicking available in IDE's, it
just doesn't seem necessary.
Plus, Eclipse does the same thing you're describing in terms of
getter/setter generation. For instance...
private String _blah; // the following accessors were generated.
public String get_blah() {
return _blah;
}
public void set_blah(String _blah) {
this._blah = _blah;
}
I don't know whether IntelliJ figures this out or no.
Abe White wrote:
>> I think it could be nicer and a bit easier if OpenJPA was automatically
>> eliminating the first _ from attribute names to build its default coumn
>> names, don't you think?
>
> The default column names are mandated by the JPA specification. And
> unless you're using OpenJPA-specific mappings, you shouldn't have to
> use OpenJPA-specific annotations just to rename columns. The JPA spec
> includes standard annotations for naming the columns in all standard
> mappings.
> _______________________________________________________________________
> Notice: This email message, together with any attachments, may contain
> information of BEA Systems, Inc., its subsidiaries and affiliated
> entities, that may be confidential, proprietary, copyrighted and/or
> legally privileged, and is intended solely for the use of the individual
> or entity named in this message. If you are not the intended recipient,
> and have received this message in error, please immediately return this
> by email and then delete it.
>
Re: Using _attributes
Posted by Abe White <aw...@bea.com>.
> I see. I specifically had problems with relation tables though. I had
> columns generated as _attribute_OTHERTABLENAME and the first _
> didn't make
> it through Derby. Hence the necessary usage of @ElementJoinColumn.
>
> Are these mandated by the spec as well?
Yes. And as I said, there are standard annotations for renaming any
columns in a standard mapping; you don't need to use @ElementJoinColumn.
http://incubator.apache.org/openjpa/docs/latest/manual/
manual.html#jpa_overview_mapping_assoccoll
_______________________________________________________________________
Notice: This email message, together with any attachments, may contain
information of BEA Systems, Inc., its subsidiaries and affiliated
entities, that may be confidential, proprietary, copyrighted and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.
Re: Using _attributes
Posted by Matthieu Riou <ma...@gmail.com>.
I see. I specifically had problems with relation tables though. I had
columns generated as _attribute_OTHERTABLENAME and the first _ didn't make
it through Derby. Hence the necessary usage of @ElementJoinColumn.
Are these mandated by the spec as well?
On 1/15/07, Abe White <aw...@bea.com> wrote:
>
> > I think it could be nicer and a bit easier if OpenJPA was
> > automatically
> > eliminating the first _ from attribute names to build its default
> > coumn
> > names, don't you think?
>
> The default column names are mandated by the JPA specification. And
> unless you're using OpenJPA-specific mappings, you shouldn't have to
> use OpenJPA-specific annotations just to rename columns. The JPA
> spec includes standard annotations for naming the columns in all
> standard mappings.
> _______________________________________________________________________
> Notice: This email message, together with any attachments, may contain
> information of BEA Systems, Inc., its subsidiaries and affiliated
> entities, that may be confidential, proprietary, copyrighted and/or
> legally privileged, and is intended solely for the use of the individual
> or entity named in this message. If you are not the intended recipient,
> and have received this message in error, please immediately return this
> by email and then delete it.
>
Re: Using _attributes
Posted by Abe White <aw...@bea.com>.
> I think it could be nicer and a bit easier if OpenJPA was
> automatically
> eliminating the first _ from attribute names to build its default
> coumn
> names, don't you think?
The default column names are mandated by the JPA specification. And
unless you're using OpenJPA-specific mappings, you shouldn't have to
use OpenJPA-specific annotations just to rename columns. The JPA
spec includes standard annotations for naming the columns in all
standard mappings.
_______________________________________________________________________
Notice: This email message, together with any attachments, may contain
information of BEA Systems, Inc., its subsidiaries and affiliated
entities, that may be confidential, proprietary, copyrighted and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.