Hi Behi,
You can use generics to define the element type of a Collection-based
relationship field or property (but then you must specify @..ToMany annotation
on that attribute). You can use it on any BLOB attribute, but it must be
a serializable type.
I don't think that generics are allowed for the entity itself.
thanks,
-marina
Behrang Saeedzadeh wrote:
> Hi,
>
> Can we use Generics when designing EJB3 Entity Beans? Say something like
> this:
>
> public abstract class Field<Type> {
> ...
> }
>
> @Entity
> public class StringField extends Field<String> {
> ...
> }
>
> or
>
> @Entity
> public class Form {
>
> public List<Field> getFields() {
> ...
> }
>
> }
>
> Form f = new Form();
> f.add(new StringField());
> f.add(new IntegerField());
> ...
>
> Thanks in advance,
> Behi
>