multi-inheritance between EntityBeans

  • Thread starter Grzegorz Trafny
  • Start date
G

Grzegorz Trafny

Hi,

Question is lightly theoretical but how to implement project
(for example: data model ) in which was used multi-inheritance?
Especially, how to model multi-inheritance in apps which data
is based on EntityBeans?

Problem is quite large because normally it is not possible to apply
(in EntityBeans) even single inheritance. However it exists patterns
to solve this problem (f.e.: article "EJB Inheritance" from onjava.com).
Maybe someone know way (similar to above mentioned) how to
by-pass problem of multi inheritance in EntityBeans (and java :)))?

Greetings
GT
 
H

Hal Rosser

Grzegorz Trafny said:
Hi,

Question is lightly theoretical but how to implement project
(for example: data model ) in which was used multi-inheritance?
Especially, how to model multi-inheritance in apps which data
is based on EntityBeans?

Problem is quite large because normally it is not possible to apply
(in EntityBeans) even single inheritance. However it exists patterns
to solve this problem (f.e.: article "EJB Inheritance" from onjava.com).
Maybe someone know way (similar to above mentioned) how to
by-pass problem of multi inheritance in EntityBeans (and java :)))?

Greetings
GT

you can try (drum roll)
implementing multiple interfaces
 
G

Grzegorz Trafny

Hal Rosser said:
Question is lightly theoretical but how to implement project
(for example: data model ) in which was used multi-inheritance?
Especially, how to model multi-inheritance in apps which data
is based on EntityBeans?
[cut]

you can try (drum roll)
implementing multiple interfaces

Not exactly, I meant situation where project directly show that
(for example) 3 entities are dependent like these:
"ClassC extends ClassA, ClassB"
and everyone class must has instance variables.

What Java programmer should do in that situation?
Is the only way out from this situation is change of
project, how better to do this?

Greetings
GT
 
G

Grzegorz Trafny

Not exactly, I meant situation where project directly show that
(for example) 3 entities are dependent like these:
"ClassC extends ClassA, ClassB"
and everyone class must has instance variables.

What Java programmer should do in that situation?
Is the only way out from this situation is change of
project, how better to do this?

Excuse me, I can't believe, nobody knows what to do?
 
T

Thomas Weidenfeller

Grzegorz said:
Excuse me, I can't believe, nobody knows what to do?

Because there isn't much to do. You don't have multiple inheritance in
Java. Period. If you base your design on multiple inheritance you are
shooting yourself in the foot. Don't shoot yourself in the foot is the
best advice, change your design.

If you want to hack around it, use interfaces and a lot of bridging
code, use a code generator, or use another language.

/Thomas
 
A

Andrei

Grzegorz Trafny said:
Hal Rosser said:
Question is lightly theoretical but how to implement project
(for example: data model ) in which was used multi-inheritance?
Especially, how to model multi-inheritance in apps which data
is based on EntityBeans?
[cut]

you can try (drum roll)
implementing multiple interfaces

Not exactly, I meant situation where project directly show that
(for example) 3 entities are dependent like these:
"ClassC extends ClassA, ClassB"
and everyone class must has instance variables.

What Java programmer should do in that situation?
Is the only way out from this situation is change of
project, how better to do this?

Greetings
GT


you could use delegates, for what is possible
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top