PDA

View Full Version : Hibernate and laszlo


medication
02-28-2006, 06:37 AM
Hi @ all,

is there a way to load and save hibernate models with laszlo?

Thanks in advance,

medication.

hkato
02-28-2006, 02:33 PM
Hi! medication.

My Website uses Hibernate and Laszlo! It's easy.

1. Initialize Hibernate Configuration and
SessionFactory class in your Servlet#init(),
(of course, this servlet's load-on-state is 0!)
and save factory instance in a class I created
to get session from anywhere with static method.

2. Get Session class in my business logic class.
Remenber to close your session.

Thanks!

medication
02-28-2006, 10:16 PM
Thank you for your fast answer.

But now I've got another question.
Is it possible to create methods which save hibernate models, which can be read by laszlo.

I want to write a method which gets data from laszlo and save this data in a hibernate model.

Thanks,

medication.

hkato
02-28-2006, 10:31 PM
> I want to write a method which gets data from
> laszlo and save this data in a hibernate model.

Of course you can.

1. create dataset or subclass of dataset in your
laszlo application, and set parameters you want
to send to server(or, servlet). Finally, call
LzDataset#doRequest().

2. Write an servlet and you can get parameters
by HttpServletRequest#getParameter(your_param_name)
send from dataset.

3. In servlet, you can create, update, deleve your own persistent objects!

for more detail, please read below reference. http://www.openlaszlo.org/lps-latest/docs/guide/data_app.html

enjoy!

medication
02-28-2006, 10:47 PM
Thank you very much.