To be honest, I'm not the best expert you can find, but I can provide you
with an example-app that uses CForms & Hibernate, using repeater-rows (which
is the biggest part of the struggle when using hibernated objects).
Let me know if you're interested and I can provide you with the full code
(off-list). For more details (a bit of explanation) I'll need a bit more
time.
Regards,
Bart
-----Original Message-----
From: Derek Hohls [mailto:[EMAIL PROTECTED]
Sent: dinsdag 18 mei 2004 11:16
To: [EMAIL PROTECTED]
Subject: RE: Simple database app with Forms/Flow ?
Please keep us (or thew Wiki!) up-to-date with
any good working examples/approaches that
you come up with - we can/should build this as
a community!
[EMAIL PROTECTED] 2004/05/18 12:01:06 PM >>>
I would definately be interested in this.. I have passed my bean
development
to someone with higher java knowledge in the hopes i can get a workign
prototype of just this type of thing. (Forseeing the end of XSP)
JD
-----Original Message-----
From: Upayavira [mailto:[EMAIL PROTECTED]
Sent: May 18, 2004 12:32 AM
To: [EMAIL PROTECTED]
Subject: Re: Simple database app with Forms/Flow ?
Derek Hohls wrote:
Upayavira
No, its not a tired drum - just potentially a very large and
maybe a "biting off more than I can chew" one. If there
was an existing, simple but *complete* project that demo'ed
this, I could at least have a solid starting point that I could
build up from. At present there are just code fragments and,
unfortunately, I'm a big picture person and I struggle to see
where all these bits fit together.
I'm happy to chat about how it might fit together. I'm new to this
too,
but perhaps we'll get some people who have done it to chime in.
I can try to paint the big picture for you, if you can handle it via
email.
My own concerns aside, I do believe that if Cocoon is going to
thrive and grow and be adopted (if that's what we want....?)
then there does need to be some clear, direct guidance on how
to tackle fairly straightforward applications - and I would argue
that a "simple interactive database, possibly with authentication"
is one "use case" for which there will be demand.
I know exactly what you mean. But we're seriously on the cutting edge
with Cocoon. This approach has only been available for 6-9 months. Not
that many people have used it, and thus not so much doco yet.
But it is well worth trying. Do you want to chat about how we can do
it?
(I know someone I can bug for guidance!)
Regards, Upayavira
[EMAIL PROTECTED] 2004/05/18 09:25:21 AM >>>
Derek Hohls wrote:
I am looking to try and build-up my learning on forms and flow (and
templating!) by applying this to a simple interactive database app.
In the past, I used XSP and ESQL, along with a primitive "meta
forms"
XML file to generate a generic form *and* populate it with data,
followed
by styling with XSLT. Database add/update/delete were then handled
by
database actions in the sitemap (along with the corresponding table
definition files). This approach may seem crude and simple but it
worked
and bugs (if any) were usually in a single XSP file and easy to
track
down.
I am now wondering what combination of "new" options to adopt in
order
to replicate this approach in the simplest possible manner - I know
there has been lots of discussion on persistence frameworks; DTO's,
DAO's and business objects - but all this seems very much like over-
kill just to tackle a few tables with a few users (in other words, a
normal in-house, customised database app). I have seen flow samples
with binding to beans and XML files, but nothing in terms of
building
up
forms dynamically and then hooking then to a normal relational
database
to read/write data.
I know that people keep harking back to O/R mapping. I've just done
my
first bit of hibernate, which I've always been mildly scared of
("isn't
it overkill???"). I couldn't believe it was that easy. You create an
object, and then persist it. Easy:
Here's the code to create a new User object:
net.sf.hibernate.Session session =
sessionFactory.openSession();
Transaction transaction = session.beginTransaction();
User user = new User();
user.setEmail("[EMAIL PROTECTED]");
user.setName("Upayavira");
session.save(user);
transaction.commit();
That is it. And then that user object and persist it. You can make an
object like that, and bind it to a form. The object is yours, it is
of
your design.
Or to check whether a user exists or not with a simple query from a
login form:
try {
transaction = session.beginTransaction();
Query query = session.createQuery("from
com.yoursite.formModels.User as user where user.email= :email and
user.password=:password");
query.setString("email",
aForm.getChild("email").getValue().toString());
query.setString("password",
aForm.getChild("password").getValue().toString());
result= (query.list().size()!=0);
transaction.commit();
} catch (Exception e){
transaction.rollback();
throw e;
} finally {
session.close();
}
return result;
That's how easy it is in Hibernate. Don't know about OJB. I've got a
feeling I'll be using O/R mapping for all sites I work on now that
have
a relational DB involved, it seems that easy.
Hope I'm not banging a tired drum!
Regards, Upayavira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]