Hi, Gary!

At the beginning I've tried to do like those experienced java gays told you:
database layer->service layer->web layer(click pages).
I've even created an google project[1] to show every one how to integrate
JPA with Click. But at the end, as a beginner java programmer,  I've got
frustrated with that code and now I'm trying to do things more simple.
Learning how to get things together manually.
So, I'm using JPA, mainly Eclipselink[2], which is very easy to setup and
use. Take a look at the EditLegalEntity.java  and ViewEditLegalEntity.java
classes[3]. The database setup is done in persistence.xml file[4] and I've
used the EntityManagerContext.java class[5] bootstrap it all.

Hth,

Gilberto
[1]http://code.google.com/p/construtor
[2]http://www.eclipse.org/eclipselink/
[3a]
http://code.google.com/p/construtor/source/browse/trunk/cip/park/src/main/java/park/web/page/EditLegalEntity.java?r=760
[3b]
http://code.google.com/p/construtor/source/browse/trunk/cip/park/src/main/java/park/web/page/ViewLegalEntity.java?r=760
[4]http://www.vogella.de/articles/JavaPersistenceAPI/article.html
[5]
http://code.google.com/p/construtor/source/browse/trunk/cip/park/src/main/java/park/orm/util/EntityManagerContext.java?r=760

2011/1/13 Schultz, Gary T - COMMERCE <[email protected]>

> Thanks for the information, I have read the Tomcat jdni resources how to. I
> also found the following to help myself understand:
>
> http://www.datadisk.co.uk/html_docs/java_app/tomcat6/tomcat6_jdbc.htm
>
> http://www.mulesoft.com/tomcat-mysql
>
> I guess my confusion stills exists in how Click is actually referencing the
> data source. In looking at the examples I can't figure it out. Maybe my lack
> of knowledge in ORM is hindering my ability to comprehend this.
>
> - Gary
>
> -----Original Message-----
> From: Bob Schellink [mailto:[email protected]]
> Sent: Thursday, January 13, 2011 12:25 AM
> To: [email protected]
> Subject: Re: Database connection
>
> You could manage the JDBC connection yourself or you could let your
> container take care of it for you. However this is dependent on the
> container you use. Here is how to do it in Tomcat:
>
>
> http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html#JDBC_Data_Sources
>
> In Java folks generally use a layered approach as can be seen in the Click
> examples, where you have separate packages for your services and pages.
> Other prefer to package by feature where each feature is placed in it's own
> package and will include the Page and Service.
>
> So depending on how you build your app will determine where your JDBC code
> lives. When using JDBC directly the code will live in a special layer just
> for Database access, often called a DAO layer.
>
> But nothing stops you from simply grabbing the JDBC connection in your Page
> and making database calls from there.
>
> Kind regards
>
> Bob
>
> On 13/01/2011 14:21, Schultz, Gary T - COMMERCE wrote:
> > I've worked with JDBC and last programmed in Java about six years ago.
> >
> > Concerning the Click data connection. After getting the JDBC connection
> established in Click application context.xml and web.xml, can I simply call
> the data connection in a Click page class and if so how is that done? Or is
> it more complicated?
> >
> > - Gary
> >
> > ________________________________________
> > From: Bob Schellink [[email protected]]
> > Sent: Wednesday, January 12, 2011 6:03 PM
> > To: [email protected]
> > Subject: Re: Database connection
> >
> > Hi Gary,
> >
> > ORMs are sophisticated tools and while they are great tools in
> > enterprise environments, they have steep learning curves. There are
> > many other ORMs besides Cayenne, including Hibernate and the standard
> Java Persistence API or JPA for short.
> >
> > There are also simpler database tools like MyBatis which is more of a
> > database mapping tool than a full blown ORM.
> >
> > While Click examples uses Cayenne you could always use straight JDBC
> which is more low level.
> >
> > WRT how this is done, there is a Cayenne DataContextFilter defined in
> > web.xml which bootstraps the environment. Cayenne has a modeler where
> > you define your DB connection and Cayenne manage these connections for
> > you. Once the DataContext is defined you use it to perform CRUD
> operations using your domain objects.
> >
> > Having a background in PHP myself I'd say that Java is heavily geared
> > towards enterprise and you will find it "heavier" than the scripting
> environment of PHP.
> >
> > Kind regards
> >
> > Bob
> >
> > On 13/01/2011 10:40, Schultz, Gary T - COMMERCE wrote:
> >> I'm starting work on an application. Normally I would use PHP, but I
> accidently found Apache Click.
> >> Looking at the documentation and examples, it appears easy to use.
> >> Maybe I missed it in the documentation, but how do you get data stored
> in a database?
> >>
> >> In a separate email exchange I received a reply from Malcolm Edgar
> >> saying the examples use Apache Cayenne ORM framework. Is there an
> >> example that elaborates on how this is done? I've never worked with a
> ORM framework, is the learning curve steep? Any other ORM Frameworks worth
> looking at?
> >>
> >> Sincerely,
> >>
> >> Gary Schultz
> >> Web Administrator/Developer
> >> Wisconsin Department of Commerce
> >>
> >> ---------------------------------------------------------------------
> >> ------------------------------- CONFIDENTIALITY NOTICE: This
> >> electronic mail transmission and any accompanying documents may
> >> contain confidential and legally privileged information. If you are
> >> not the intended recipient, you are strictly prohibited from any
> >> disclosure, copying, distribution, or storage of the contents of the
> >> information contained in the transmission. If you have received this
> transmission in error, please notify the sender and delete the message.
> Thank you.
> >
> >
> > CONFIDENTIALITY NOTICE:  This electronic mail transmission and any
> accompanying documents may contain confidential and legally privileged
> information.  If you are not the intended recipient, you are strictly
> prohibited from any disclosure, copying, distribution, or storage of the
> contents of the information contained in the transmission.  If you have
> received this transmission in error, please notify the sender and delete the
> message. Thank you.
> >
>
>

Reply via email to