[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.technology.dali] Re: Generate Entities not adding @Table or @Column annotations

Hi Rick,

This is by design. JPA utilizes a concept referred to as "configuration by exception", which for JPA basically means that where an object "matches" a relational schema, there is no need to define the mapping. These implied mappings are defined by the JPA specification, and a persistence provider will use these default mappings by default unless you decide to specify a mapping that overrides it.

For the example you mention, there is a default Column value that is assumed, in this case being the attribute name. Sine the attribute name and the table's column name match, there is no need to specify the @Column. If they didn't match, the Entity Generation would insert @Column with an appropriate value.

All of these "defaults" are defined in the JPA Spec. If you use the Dali views, you can actually see what the default values are in a given mapping. Our validation will tell you when the defaults don't work, and in those cases you will need to override the default mapping. These are a couple of the ways that Dali makes life easier for JPA development.

Hope this helps,
Neil


Rick Crawford wrote:

I'm using Eclipse 3.4.1, trying to generate entities using the JPA wizard to generate entities from existing tables in our DB2 database. I go thru all the steps, and get no errors. The entity classes are generated, but the only JPA annotation that is added is the @Entity annotation. The @Table, the @Column's, etc. are not added.

The generated classes do have properties for each of the columns in the table(s), but no @Column annotations. Is this the expected behavior, or am I missing something?

Thanks!
Rick