Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Adapter in J2EE  RSS feed

 
R K Singh
Ranch Hand
Posts: 5390
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have large number of Entity beans(CMP) and session beans.
I was thinking to apply Adapter pattern(have a class with blank implementation and use it as super class for all other classes) while implementing these beans.

But I googled to find if it was normal pratice to do so.
But I could not found any relevant information.

The patterns available for J2EE, also dont discuss much about adapter pattern.

I was just wondering, what could be implecations for using adapter pattern in this way in J2EE application ?

Please provide your views.
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I like the idea when using EJB3 and Java5. Because I can make a Generic Abstract Class that all Beans implement, real clean, and most of the time, done right, each Bean gets no code except to declare what the Generic Types are.

Mark
 
R K Singh
Ranch Hand
Posts: 5390
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mark,
Thanks for support and apologies for late reply as I was not in the town.

Why would you like to restrict this approach to only EJB3 and Java5 ?

I tested locally with EJB2 and Java2. It worked fine.

My problem is that, why it is not recommened ?
I googled a lot but fail to find a page that suggests this approach.

After not finding any page on this, I became a little sceptic to use it in my project.

I think having Generic type for Session and Entity in the project would help a lot and avoid unneccessary coding of implementing blank methods.

I know I am right but need confirmation from Gurus.

Please provide your views on the same.
[ February 20, 2007: Message edited by: R K Singh ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!