RE: Best Approach for Database Access?

2002-02-12 Thread Keith Chew

Hi Paul

I follow this design practice for both EJB and non-EJB applications. The
ones marked with * live at the application server JVM.

(1) Non-EJB environment
===
JSP - ActionBean - ServiceBean - DaoBean - DB

(2) EJB environment (BMP or Session)

JSP - ActionBean - * ServiceBean - * DaoBean - DB

(3) EJB environment (CMP)
=
JSP - ActionBean - * ServiceBean - DB

Notes:
==
ActionBeans are the action classes of Struts
DaoBeans are normal JavaBean classes which knows how to communicate with the
DB, ie all SQL code goes here.
In (1), you need to take care of transactions on your own.
The ServiceBean in (1) is a normal JavaBean, but an EJB in (2) and (3)
In (3), we do not need a Dao, since the CMP does all that work for us.

Hope this helps
Keith

-Original Message-
From: Paul Idusogie [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 13 February 2002 9:38 a.m.
To: [EMAIL PROTECTED]
Subject: Best Approach for Database Access?
Importance: High


Could you kindly provide guidance on the best approach to implement database
access.?
I have encountered various schools of thought in my reading, that suggest
extracting the business logic and database code from the jsp into a jsp bean
or ejb or servlet.

Thanks,

Paul Idusogie
Technical Architect
Consulting Services
Stellent Inc.
 Golden Triangle Drive
Eden Prairie, MN 55104
Desk: 952.656.2755
Fax: 952.903.2115
Email: [EMAIL PROTECTED]
website: http://www.stellent.com

--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Best Approach for Database Access?

2002-02-12 Thread Thompson, Darryl

Hello Keith,

 In my environment we employ options 2 and 3 but with this little twist:

  3) EJB environment (CMP)
 JSP - ActionBean - ( ServiceHelper --ServiceLocator ) - 
ServiceBean - DB

The ServiceLocator is a regular Java class that encapsulates all jndi Home
lookup logic, and the ther ServiceHelper is also a regular Java class that
contains methods to
support the business model. All ServiceHelper methods are static and the
Action Class calls these from the appropriate exec(..) method.

We are still trying to get a handle on this framework so if this is in left
field let me know.

Regards,
Darryl

 -Original Message-
 From: Keith Chew [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, February 12, 2002 2:47 PM
 To:   Struts Users Mailing List
 Subject:  RE: Best Approach for Database Access?
 
 Hi Paul
 
 I follow this design practice for both EJB and non-EJB applications. The
 ones marked with * live at the application server JVM.
 
 (1) Non-EJB environment
 ===
 JSP - ActionBean - ServiceBean - DaoBean - DB
 
 (2) EJB environment (BMP or Session)
 
 JSP - ActionBean - * ServiceBean - * DaoBean - DB
 
 (3) EJB environment (CMP)
 =
 JSP - ActionBean - * ServiceBean - DB
 
 Notes:
 ==
 ActionBeans are the action classes of Struts
 DaoBeans are normal JavaBean classes which knows how to communicate with
 the
 DB, ie all SQL code goes here.
 In (1), you need to take care of transactions on your own.
 The ServiceBean in (1) is a normal JavaBean, but an EJB in (2) and (3)
 In (3), we do not need a Dao, since the CMP does all that work for us.
 
 Hope this helps
 Keith
 
 -Original Message-
 From: Paul Idusogie [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, 13 February 2002 9:38 a.m.
 To: [EMAIL PROTECTED]
 Subject: Best Approach for Database Access?
 Importance: High
 
 
 Could you kindly provide guidance on the best approach to implement
 database
 access.?
 I have encountered various schools of thought in my reading, that suggest
 extracting the business logic and database code from the jsp into a jsp
 bean
 or ejb or servlet.
 
 Thanks,
 
 Paul Idusogie
 Technical Architect
 Consulting Services
 Stellent Inc.
  Golden Triangle Drive
 Eden Prairie, MN 55104
 Desk: 952.656.2755
 Fax: 952.903.2115
 Email: [EMAIL PROTECTED]
 website: http://www.stellent.com
 
 --
 To unsubscribe, e-mail:
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]
 
 
 --
 To unsubscribe, e-mail:
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Best Approach for Database Access?

2002-02-12 Thread Keith Chew

Hi Darryl

Yes, I use a ResourceLocator, which does that same thing. In addition, it
does caching of home interfaces and  storing of application context
constants, thus not called a ServiceLocator (locating a service is only one
of it's jobs).

I have made the ServiceLocator a Singleton, thus avoided having a
ServiceHelper. So, to get an EJB, I just go:

DummyService dummyService = (DummyService)
ResourceLocator.getInstance().getEjb (DummyServiceBeanHome.class);

One line, simple and tidy. Also, the JNDI name is in the home interface,
thus the ResourceLocator uses reflection to get that. Optionally, you can
choose to supply a JNDI name.

Hope this helps.

Keith

-Original Message-
From: Thompson, Darryl [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 13 February 2002 10:18 a.m.
To: Struts Users Mailing List
Subject: RE: Best Approach for Database Access?


Hello Keith,

 In my environment we employ options 2 and 3 but with this little twist:

  3) EJB environment (CMP)
 JSP - ActionBean - ( ServiceHelper --ServiceLocator ) - 
ServiceBean - DB

The ServiceLocator is a regular Java class that encapsulates all jndi Home
lookup logic, and the ther ServiceHelper is also a regular Java class that
contains methods to
support the business model. All ServiceHelper methods are static and the
Action Class calls these from the appropriate exec(..) method.

We are still trying to get a handle on this framework so if this is in left
field let me know.

Regards,
Darryl

 -Original Message-
 From: Keith Chew [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, February 12, 2002 2:47 PM
 To:   Struts Users Mailing List
 Subject:  RE: Best Approach for Database Access?

 Hi Paul

 I follow this design practice for both EJB and non-EJB applications. The
 ones marked with * live at the application server JVM.

 (1) Non-EJB environment
 ===
 JSP - ActionBean - ServiceBean - DaoBean - DB

 (2) EJB environment (BMP or Session)
 
 JSP - ActionBean - * ServiceBean - * DaoBean - DB

 (3) EJB environment (CMP)
 =
 JSP - ActionBean - * ServiceBean - DB

 Notes:
 ==
 ActionBeans are the action classes of Struts
 DaoBeans are normal JavaBean classes which knows how to communicate with
 the
 DB, ie all SQL code goes here.
 In (1), you need to take care of transactions on your own.
 The ServiceBean in (1) is a normal JavaBean, but an EJB in (2) and (3)
 In (3), we do not need a Dao, since the CMP does all that work for us.

 Hope this helps
 Keith

 -Original Message-
 From: Paul Idusogie [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, 13 February 2002 9:38 a.m.
 To: [EMAIL PROTECTED]
 Subject: Best Approach for Database Access?
 Importance: High


 Could you kindly provide guidance on the best approach to implement
 database
 access.?
 I have encountered various schools of thought in my reading, that suggest
 extracting the business logic and database code from the jsp into a jsp
 bean
 or ejb or servlet.

 Thanks,

 Paul Idusogie
 Technical Architect
 Consulting Services
 Stellent Inc.
  Golden Triangle Drive
 Eden Prairie, MN 55104
 Desk: 952.656.2755
 Fax: 952.903.2115
 Email: [EMAIL PROTECTED]
 website: http://www.stellent.com

 --
 To unsubscribe, e-mail:
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]


 --
 To unsubscribe, e-mail:
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: Best Approach for Database Access?

2002-02-12 Thread Francisco Hernandez

once you get your DummyService, are you passing it the current ActionForm?

how are you getting results/errors from that DummyService?

- Original Message -
From: Keith Chew [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Tuesday, February 12, 2002 1:43 PM
Subject: RE: Best Approach for Database Access?


 Hi Darryl

 Yes, I use a ResourceLocator, which does that same thing. In addition, it
 does caching of home interfaces and  storing of application context
 constants, thus not called a ServiceLocator (locating a service is only
one
 of it's jobs).

 I have made the ServiceLocator a Singleton, thus avoided having a
 ServiceHelper. So, to get an EJB, I just go:

 DummyService dummyService = (DummyService)
 ResourceLocator.getInstance().getEjb (DummyServiceBeanHome.class);

 One line, simple and tidy. Also, the JNDI name is in the home interface,
 thus the ResourceLocator uses reflection to get that. Optionally, you can
 choose to supply a JNDI name.

 Hope this helps.

 Keith

 -Original Message-
 From: Thompson, Darryl [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, 13 February 2002 10:18 a.m.
 To: Struts Users Mailing List
 Subject: RE: Best Approach for Database Access?


 Hello Keith,

  In my environment we employ options 2 and 3 but with this little twist:

   3) EJB environment (CMP)
  JSP - ActionBean - ( ServiceHelper --ServiceLocator ) - 
 ServiceBean - DB

 The ServiceLocator is a regular Java class that encapsulates all jndi Home
 lookup logic, and the ther ServiceHelper is also a regular Java class that
 contains methods to
 support the business model. All ServiceHelper methods are static and the
 Action Class calls these from the appropriate exec(..) method.

 We are still trying to get a handle on this framework so if this is in
left
 field let me know.

 Regards,
 Darryl

  -Original Message-
  From: Keith Chew [SMTP:[EMAIL PROTECTED]]
  Sent: Tuesday, February 12, 2002 2:47 PM
  To: Struts Users Mailing List
  Subject: RE: Best Approach for Database Access?
 
  Hi Paul
 
  I follow this design practice for both EJB and non-EJB applications. The
  ones marked with * live at the application server JVM.
 
  (1) Non-EJB environment
  ===
  JSP - ActionBean - ServiceBean - DaoBean - DB
 
  (2) EJB environment (BMP or Session)
  
  JSP - ActionBean - * ServiceBean - * DaoBean - DB
 
  (3) EJB environment (CMP)
  =
  JSP - ActionBean - * ServiceBean - DB
 
  Notes:
  ==
  ActionBeans are the action classes of Struts
  DaoBeans are normal JavaBean classes which knows how to communicate with
  the
  DB, ie all SQL code goes here.
  In (1), you need to take care of transactions on your own.
  The ServiceBean in (1) is a normal JavaBean, but an EJB in (2) and (3)
  In (3), we do not need a Dao, since the CMP does all that work for us.
 
  Hope this helps
  Keith
 
  -Original Message-
  From: Paul Idusogie [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, 13 February 2002 9:38 a.m.
  To: [EMAIL PROTECTED]
  Subject: Best Approach for Database Access?
  Importance: High
 
 
  Could you kindly provide guidance on the best approach to implement
  database
  access.?
  I have encountered various schools of thought in my reading, that
suggest
  extracting the business logic and database code from the jsp into a jsp
  bean
  or ejb or servlet.
 
  Thanks,
 
  Paul Idusogie
  Technical Architect
  Consulting Services
  Stellent Inc.
   Golden Triangle Drive
  Eden Prairie, MN 55104
  Desk: 952.656.2755
  Fax: 952.903.2115
  Email: [EMAIL PROTECTED]
  website: http://www.stellent.com
 
  --
  To unsubscribe, e-mail:
  mailto:[EMAIL PROTECTED]
  For additional commands, e-mail:
  mailto:[EMAIL PROTECTED]
 
 
  --
  To unsubscribe, e-mail:
  mailto:[EMAIL PROTECTED]
  For additional commands, e-mail:
  mailto:[EMAIL PROTECTED]

 --
 To unsubscribe, e-mail:
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]


 --
 To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
mailto:[EMAIL PROTECTED]



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Best Approach for Database Access?

2002-02-12 Thread Galbreath, Mark

Check out the Guidelines and Patterns at

http://java.sun.com/blueprints/,

Accessing Relational Databases at

http://jakarta.apache.org/struts/userGuide/index.html,

and get 'hold of Core J2EE Patterns by Alur, et al.

Mark

-Original Message-
From: Paul Idusogie [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 12, 2002 3:38 PM

Could you kindly provide guidance on the best approach to implement database
access.?
I have encountered various schools of thought in my reading, that suggest
extracting the business logic and database code from the jsp into a jsp bean
or ejb or servlet.

Thanks,

Paul Idusogie 

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Subject: Re: Best Approach for Database Access?

2002-02-12 Thread @Basebeans.com

Subject: Subject: Re: Best Approach for Database Access?
5311:From: Vic Cekvenich [EMAIL PROTECTED]
 ===

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Best Approach for Database Access?

2002-02-12 Thread Rooms, Christoph

Check out castor, worked fine for me !!!

http://www.castor.org

-Original Message-
From: Galbreath, Mark
To: 'Struts Users Mailing List'
Sent: 12/02/2002 22:52
Subject: RE: Best Approach for Database Access?

Check out the Guidelines and Patterns at

http://java.sun.com/blueprints/,

Accessing Relational Databases at

http://jakarta.apache.org/struts/userGuide/index.html,

and get 'hold of Core J2EE Patterns by Alur, et al.

Mark

-Original Message-
From: Paul Idusogie [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 12, 2002 3:38 PM

Could you kindly provide guidance on the best approach to implement
database
access.?
I have encountered various schools of thought in my reading, that
suggest
extracting the business logic and database code from the jsp into a jsp
bean
or ejb or servlet.

Thanks,

Paul Idusogie 

--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Best Approach for Database Access?

2002-02-12 Thread Keith Chew


More pointers...

In the example I gave earlier, the DaoBean is responsible for communicating
with the database. So, you can implement the data access with any of these
technologies:
- direct SQL
- O/R mapper like Castor, Toplink, Cocobase
- JDO
- ...

In the CMP environment, the container will take care of all these. However,
you need to configure the O/R settings at the container level.

PS: The Core J2EE Patterns is a very good reference book. Definitely
worthwhile getting a copy.

Keith


-Original Message-
From: Rooms, Christoph [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 13 February 2002 11:04 a.m.
To: 'Galbreath, Mark '; ''Struts Users Mailing List' '
Subject: RE: Best Approach for Database Access?


Check out castor, worked fine for me !!!

http://www.castor.org

-Original Message-
From: Galbreath, Mark
To: 'Struts Users Mailing List'
Sent: 12/02/2002 22:52
Subject: RE: Best Approach for Database Access?

Check out the Guidelines and Patterns at

http://java.sun.com/blueprints/,

Accessing Relational Databases at

http://jakarta.apache.org/struts/userGuide/index.html,

and get 'hold of Core J2EE Patterns by Alur, et al.

Mark

-Original Message-
From: Paul Idusogie [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 12, 2002 3:38 PM

Could you kindly provide guidance on the best approach to implement
database
access.?
I have encountered various schools of thought in my reading, that
suggest
extracting the business logic and database code from the jsp into a jsp
bean
or ejb or servlet.

Thanks,

Paul Idusogie

--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]