EJB 3: Dynamic Element Values

Hi all,

I'm fairly new to EJB3 and I'm wondering whether it is possible to dynamically assign annotation element values like this:

@Entity

@Table(name=myClass.getTableName())

publicclass Employee{

...

}

If not, what else can I do to use the same entity class and respective service class for different tables, which all have the same fields?

Thanks in advance.

Stephan

[551 byte] By [bardubitzkia] at [2007-11-26 16:17:06]
# 1

Hi,

You should be able to achieve what you're after extending the Employee entity and override @Table in every subclass. It should work. (I'd also be looking for something helpful in persistence.xml as that's where mapping and other configurations are - maybe there's a tag for mapping a class to a table?)

Jacek

JacekLaskowskia at 2007-7-8 22:40:13 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...