Panaki,
I read your blog entry on persisting a generic graph and am very interested
in using something similar to this for some of my entities.
The pattern I'm looking to do is something like the following:
@MappedSuperclass
> public abstract class Foo implements Serializable {
> @Id
> private long id;
>
> public long getId() { return id; }
> public void setId(long id) { this.id = id; }
>
> public void doStuff() {
> // stuff. very abstract, to be sure.
> }
> }
>
> @Entity
> public class ConcreteFoo extends Foo {
> public void doConcreteStuff() {
> // more concrete stuff
> }
> }
>
> @Entity
> public class OtherFoo extends Foo {
> public void doOtherStuff() {
> // more concrete stuff
> }
> }
>
> @Entity
> public class Funk<F extends Foo> {
> private F foo;
>
> public F getFoo() { return foo; }
>
> public void setFoo(F foo) { this.foo = foo; }
> }
>
The idea would be to allow client code to create "new Funk<ConcreteFoo>()"
and work with the class in a simpler fashion. (think Foo == Party,
ConcreteFoo == Person, OtherFoo == Organization and Funk ==
PartyRelationship for more of a sense what I'm going for here.)
Does this make sense and is it possible? In your blog entry you mention the
@Type annotation. Can't find references to it anywhere so thought I'd ask
the expert.
Cheers!
--
Alexander R. Saint Croix
|