Re: wicket and JPA

2013-06-14 Thread Sven Meier
It depends whether your working with detached or manages entities. Are 
you using OSIV?


Sven

On 06/14/2013 12:22 AM, Boris Brinza wrote:

Hello,
ok, i understand what my problem was,
I've update my code to use detachable model, quite easy refactorting.

But it only postponed my problem to model onDetach, if i understand it 
right.
In pdf, If we don't want to loose these changes we must explicitly 
persist the entity before the detaching phase occurs.
So same problem with update of JPA enbtity. Insert is ok, just call 
persist(), but update?




On 06/13/2013 02:52 PM, Sven Meier wrote:
Please read 9.6 Detachable models of the Wicket Free Guide and come 
back with your questions.


Sven

On 06/13/2013 01:20 PM, Boris Brinza wrote:

Hello to all,
I have some fundamental issues with integration of jpa into wicket.
I develop web application using wicket 6 and JPA (eclipselink). 
Maybe next question is more JPA oriented, but nevertheless:


Lets say i have
class BaseDetailPageT extens BaseDO extends WebPage {
protected T dbEntity;

}

where dbEntity is instance of jpa persisted object.
BaseDetail page contains form for editing db entity using 
CompoundPropertyModel.


After i open detail page, entity is read from DB and page is 
displayed (if edit button is pressed) or i create new instance of 
object (if add button is pressed).


After submit, if i want to add new record, everything is clear, i 
call beginTX(), entityManager.persist(dbEntity), commitTX().


But what about updating existing record?

Every example for JPA shows some basic code like this:
beginTX()
dbObject.setXXX();
dbObject.setYYY();
commitTX()


But how to integrate this into wicket form using compound property 
model?
There is no such code for setting properties of db object, and jpa 
does not have anything like entityManager.update().


Now i use hack (by my opinion it';s a hack)

beginTX()
entityManaget.detach(dbObject);
entityManager.merge(dbObject)
commitTX()

but i am not sure, if it's right solution (or i'm almost sure it's 
not right attitude)


Is there any tutorial how to integrate these frameworks, or some 
simple opensource project to check how it's solved?


Thanks for any advice,
Boris




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org







-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: wicket and JPA

2013-06-14 Thread Evgheni Emelianov
Try first to refresh your entity with entitymanagerObject.refresh(), and use 
the return object for an update and then merge()

Am 14.06.2013 um 10:14 schrieb Sven Meier s...@meiers.net:

 It depends whether your working with detached or manages entities. Are you 
 using OSIV?
 
 Sven
 
 On 06/14/2013 12:22 AM, Boris Brinza wrote:
 Hello,
 ok, i understand what my problem was,
 I've update my code to use detachable model, quite easy refactorting.
 
 But it only postponed my problem to model onDetach, if i understand it right.
 In pdf, If we don't want to loose these changes we must explicitly persist 
 the entity before the detaching phase occurs.
 So same problem with update of JPA enbtity. Insert is ok, just call 
 persist(), but update?
 
 
 
 On 06/13/2013 02:52 PM, Sven Meier wrote:
 Please read 9.6 Detachable models of the Wicket Free Guide and come back 
 with your questions.
 
 Sven
 
 On 06/13/2013 01:20 PM, Boris Brinza wrote:
 Hello to all,
 I have some fundamental issues with integration of jpa into wicket.
 I develop web application using wicket 6 and JPA (eclipselink). Maybe next 
 question is more JPA oriented, but nevertheless:
 
 Lets say i have
 class BaseDetailPageT extens BaseDO extends WebPage {
protected T dbEntity;
 
 }
 
 where dbEntity is instance of jpa persisted object.
 BaseDetail page contains form for editing db entity using 
 CompoundPropertyModel.
 
 After i open detail page, entity is read from DB and page is displayed (if 
 edit button is pressed) or i create new instance of object (if add button 
 is pressed).
 
 After submit, if i want to add new record, everything is clear, i call 
 beginTX(), entityManager.persist(dbEntity), commitTX().
 
 But what about updating existing record?
 
 Every example for JPA shows some basic code like this:
 beginTX()
 dbObject.setXXX();
 dbObject.setYYY();
 commitTX()
 
 
 But how to integrate this into wicket form using compound property model?
 There is no such code for setting properties of db object, and jpa does 
 not have anything like entityManager.update().
 
 Now i use hack (by my opinion it';s a hack)
 
 beginTX()
 entityManaget.detach(dbObject);
 entityManager.merge(dbObject)
 commitTX()
 
 but i am not sure, if it's right solution (or i'm almost sure it's not 
 right attitude)
 
 Is there any tutorial how to integrate these frameworks, or some simple 
 opensource project to check how it's solved?
 
 Thanks for any advice,
 Boris
 
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: wicket and JPA

2013-06-14 Thread heapifyman
Correct me if I'm wrong but I think as long as dbObject is still managed
code like the following should persist the changes to dbObject, i.e.
changes to dbObject will be saved once the transaction commits.
beginTX()
dbObject.setXXX();
dbObject.setYYY();
commitTX()

If dbObject is detached you will have to call
entityManager.merge(dbObject) before committing the transaction.



2013/6/14 Evgheni Emelianov e.emelia...@gmx.net

 Try first to refresh your entity with entitymanagerObject.refresh(), and
 use the return object for an update and then merge()

 Am 14.06.2013 um 10:14 schrieb Sven Meier s...@meiers.net:

  It depends whether your working with detached or manages entities. Are
 you using OSIV?
 
  Sven
 
  On 06/14/2013 12:22 AM, Boris Brinza wrote:
  Hello,
  ok, i understand what my problem was,
  I've update my code to use detachable model, quite easy refactorting.
 
  But it only postponed my problem to model onDetach, if i understand it
 right.
  In pdf, If we don't want to loose these changes we must explicitly
 persist the entity before the detaching phase occurs.
  So same problem with update of JPA enbtity. Insert is ok, just call
 persist(), but update?
 
 
 
  On 06/13/2013 02:52 PM, Sven Meier wrote:
  Please read 9.6 Detachable models of the Wicket Free Guide and come
 back with your questions.
 
  Sven
 
  On 06/13/2013 01:20 PM, Boris Brinza wrote:
  Hello to all,
  I have some fundamental issues with integration of jpa into wicket.
  I develop web application using wicket 6 and JPA (eclipselink). Maybe
 next question is more JPA oriented, but nevertheless:
 
  Lets say i have
  class BaseDetailPageT extens BaseDO extends WebPage {
 protected T dbEntity;
 
  }
 
  where dbEntity is instance of jpa persisted object.
  BaseDetail page contains form for editing db entity using
 CompoundPropertyModel.
 
  After i open detail page, entity is read from DB and page is
 displayed (if edit button is pressed) or i create new instance of object
 (if add button is pressed).
 
  After submit, if i want to add new record, everything is clear, i
 call beginTX(), entityManager.persist(dbEntity), commitTX().
 
  But what about updating existing record?
 
  Every example for JPA shows some basic code like this:
  beginTX()
  dbObject.setXXX();
  dbObject.setYYY();
  commitTX()
 
 
  But how to integrate this into wicket form using compound property
 model?
  There is no such code for setting properties of db object, and jpa
 does not have anything like entityManager.update().
 
  Now i use hack (by my opinion it';s a hack)
 
  beginTX()
  entityManaget.detach(dbObject);
  entityManager.merge(dbObject)
  commitTX()
 
  but i am not sure, if it's right solution (or i'm almost sure it's
 not right attitude)
 
  Is there any tutorial how to integrate these frameworks, or some
 simple opensource project to check how it's solved?
 
  Thanks for any advice,
  Boris
 
 
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: wicket and JPA

2013-06-14 Thread Boris Brinza

Hello,
thanks for advices to all, still in war with jpa :-)

On 06/14/2013 01:27 PM, Evgheni Emelianov wrote:

Try first to refresh your entity with entitymanagerObject.refresh(), and use 
the return object for an update and then merge()

Am 14.06.2013 um 10:14 schrieb Sven Meier s...@meiers.net:


It depends whether your working with detached or manages entities. Are you 
using OSIV?

Sven

On 06/14/2013 12:22 AM, Boris Brinza wrote:

Hello,
ok, i understand what my problem was,
I've update my code to use detachable model, quite easy refactorting.

But it only postponed my problem to model onDetach, if i understand it right.
In pdf, If we don't want to loose these changes we must explicitly persist the 
entity before the detaching phase occurs.
So same problem with update of JPA enbtity. Insert is ok, just call persist(), 
but update?



On 06/13/2013 02:52 PM, Sven Meier wrote:

Please read 9.6 Detachable models of the Wicket Free Guide and come back with 
your questions.

Sven

On 06/13/2013 01:20 PM, Boris Brinza wrote:

Hello to all,
I have some fundamental issues with integration of jpa into wicket.
I develop web application using wicket 6 and JPA (eclipselink). Maybe next 
question is more JPA oriented, but nevertheless:

Lets say i have
class BaseDetailPageT extens BaseDO extends WebPage {
protected T dbEntity;

}

where dbEntity is instance of jpa persisted object.
BaseDetail page contains form for editing db entity using CompoundPropertyModel.

After i open detail page, entity is read from DB and page is displayed (if edit 
button is pressed) or i create new instance of object (if add button is 
pressed).

After submit, if i want to add new record, everything is clear, i call 
beginTX(), entityManager.persist(dbEntity), commitTX().

But what about updating existing record?

Every example for JPA shows some basic code like this:
beginTX()
dbObject.setXXX();
dbObject.setYYY();
commitTX()


But how to integrate this into wicket form using compound property model?
There is no such code for setting properties of db object, and jpa does not 
have anything like entityManager.update().

Now i use hack (by my opinion it';s a hack)

beginTX()
entityManaget.detach(dbObject);
entityManager.merge(dbObject)
commitTX()

but i am not sure, if it's right solution (or i'm almost sure it's not right 
attitude)

Is there any tutorial how to integrate these frameworks, or some simple 
opensource project to check how it's solved?

Thanks for any advice,
Boris




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org





-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




--

S pozdravom

Boris Brinza

---
HT Solution s.r.o.
Digital Park II
Einsteinova 25
851 01 Bratislava
Slovakia

Phone: +421 2 3500 2512,  Mobile: +421 903 602 126
E-mail: boris.bri...@htsolution.sk,  Internet: www.htsolution.sk


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: wicket and JPA

2013-06-14 Thread Boris Brinza
You're right, but if you use propertymodel with dbEntity as model 
object, there is no such code in your form like getModelObject().setXXX(),

or another question: where and when to start tx and commit tx?

On 06/14/2013 02:14 PM, heapifyman wrote:

Correct me if I'm wrong but I think as long as dbObject is still managed
code like the following should persist the changes to dbObject, i.e.
changes to dbObject will be saved once the transaction commits.
beginTX()
dbObject.setXXX();
dbObject.setYYY();
commitTX()

If dbObject is detached you will have to call
entityManager.merge(dbObject) before committing the transaction.



2013/6/14 Evgheni Emelianov e.emelia...@gmx.net


Try first to refresh your entity with entitymanagerObject.refresh(), and
use the return object for an update and then merge()

Am 14.06.2013 um 10:14 schrieb Sven Meier s...@meiers.net:


It depends whether your working with detached or manages entities. Are

you using OSIV?

Sven

On 06/14/2013 12:22 AM, Boris Brinza wrote:

Hello,
ok, i understand what my problem was,
I've update my code to use detachable model, quite easy refactorting.

But it only postponed my problem to model onDetach, if i understand it

right.

In pdf, If we don't want to loose these changes we must explicitly

persist the entity before the detaching phase occurs.

So same problem with update of JPA enbtity. Insert is ok, just call

persist(), but update?



On 06/13/2013 02:52 PM, Sven Meier wrote:

Please read 9.6 Detachable models of the Wicket Free Guide and come

back with your questions.

Sven

On 06/13/2013 01:20 PM, Boris Brinza wrote:

Hello to all,
I have some fundamental issues with integration of jpa into wicket.
I develop web application using wicket 6 and JPA (eclipselink). Maybe

next question is more JPA oriented, but nevertheless:

Lets say i have
class BaseDetailPageT extens BaseDO extends WebPage {
protected T dbEntity;

}

where dbEntity is instance of jpa persisted object.
BaseDetail page contains form for editing db entity using

CompoundPropertyModel.

After i open detail page, entity is read from DB and page is

displayed (if edit button is pressed) or i create new instance of object
(if add button is pressed).

After submit, if i want to add new record, everything is clear, i

call beginTX(), entityManager.persist(dbEntity), commitTX().

But what about updating existing record?

Every example for JPA shows some basic code like this:
beginTX()
dbObject.setXXX();
dbObject.setYYY();
commitTX()


But how to integrate this into wicket form using compound property

model?

There is no such code for setting properties of db object, and jpa

does not have anything like entityManager.update().

Now i use hack (by my opinion it';s a hack)

beginTX()
entityManaget.detach(dbObject);
entityManager.merge(dbObject)
commitTX()

but i am not sure, if it's right solution (or i'm almost sure it's

not right attitude)

Is there any tutorial how to integrate these frameworks, or some

simple opensource project to check how it's solved?

Thanks for any advice,
Boris




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org





-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org





--

S pozdravom

Boris Brinza

---
HT Solution s.r.o.
Digital Park II
Einsteinova 25
851 01 Bratislava
Slovakia

Phone: +421 2 3500 2512,  Mobile: +421 903 602 126
E-mail: boris.bri...@htsolution.sk,  Internet: www.htsolution.sk


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: wicket and JPA

2013-06-14 Thread Sven Meier

getModelObject().setXXX()

This is what each FormComponent will do for you.

 where and when to start tx and commit tx?

Easiest is to use OSIV, using Spring's filter [1] or a custom request 
listener in Wicket.


Sven

[1]http://blog.smartkey.co.uk/2010/03/open-session-in-view-pattern-spring-jpa


On 06/14/2013 02:24 PM, Boris Brinza wrote:
You're right, but if you use propertymodel with dbEntity as model 
object, there is no such code in your form like 
getModelObject().setXXX(),

or another question: where and when to start tx and commit tx?

On 06/14/2013 02:14 PM, heapifyman wrote:
Correct me if I'm wrong but I think as long as dbObject is still 
managed

code like the following should persist the changes to dbObject, i.e.
changes to dbObject will be saved once the transaction commits.
beginTX()
dbObject.setXXX();
dbObject.setYYY();
commitTX()

If dbObject is detached you will have to call
entityManager.merge(dbObject) before committing the transaction.



2013/6/14 Evgheni Emelianov e.emelia...@gmx.net

Try first to refresh your entity with entitymanagerObject.refresh(), 
and

use the return object for an update and then merge()

Am 14.06.2013 um 10:14 schrieb Sven Meier s...@meiers.net:


It depends whether your working with detached or manages entities. Are

you using OSIV?

Sven

On 06/14/2013 12:22 AM, Boris Brinza wrote:

Hello,
ok, i understand what my problem was,
I've update my code to use detachable model, quite easy refactorting.

But it only postponed my problem to model onDetach, if i 
understand it

right.

In pdf, If we don't want to loose these changes we must explicitly

persist the entity before the detaching phase occurs.

So same problem with update of JPA enbtity. Insert is ok, just call

persist(), but update?



On 06/13/2013 02:52 PM, Sven Meier wrote:
Please read 9.6 Detachable models of the Wicket Free Guide and 
come

back with your questions.

Sven

On 06/13/2013 01:20 PM, Boris Brinza wrote:

Hello to all,
I have some fundamental issues with integration of jpa into wicket.
I develop web application using wicket 6 and JPA (eclipselink). 
Maybe

next question is more JPA oriented, but nevertheless:

Lets say i have
class BaseDetailPageT extens BaseDO extends WebPage {
protected T dbEntity;

}

where dbEntity is instance of jpa persisted object.
BaseDetail page contains form for editing db entity using

CompoundPropertyModel.

After i open detail page, entity is read from DB and page is
displayed (if edit button is pressed) or i create new instance of 
object

(if add button is pressed).

After submit, if i want to add new record, everything is clear, i

call beginTX(), entityManager.persist(dbEntity), commitTX().

But what about updating existing record?

Every example for JPA shows some basic code like this:
beginTX()
dbObject.setXXX();
dbObject.setYYY();
commitTX()


But how to integrate this into wicket form using compound property

model?

There is no such code for setting properties of db object, and jpa

does not have anything like entityManager.update().

Now i use hack (by my opinion it';s a hack)

beginTX()
entityManaget.detach(dbObject);
entityManager.merge(dbObject)
commitTX()

but i am not sure, if it's right solution (or i'm almost sure it's

not right attitude)

Is there any tutorial how to integrate these frameworks, or some

simple opensource project to check how it's solved?

Thanks for any advice,
Boris




- 


To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



- 


To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org





-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org








-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: wicket and JPA

2013-06-14 Thread Evgheni Emelianov
you are right but if you trying to get the entity after detach, you get the 
cashed version of this object, also you don't have the changes in the database, 
even if you merge, but if you refresh your entity you get a new updated object 
with all changes that were made, and the changes will be written in the 
database.


sorry for the previous mail :)

Evgheni
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: wicket and JPA

2013-06-14 Thread Evgheni Emelianov
you are right but if you trying to get the entity after detach, 
Am 14.06.2013 um 14:14 schrieb heapifyman heapify...@gmail.com:

 Correct me if I'm wrong but I think as long as dbObject is still managed
 code like the following should persist the changes to dbObject, i.e.
 changes to dbObject will be saved once the transaction commits.
 beginTX()
 dbObject.setXXX();
 dbObject.setYYY();
 commitTX()
 
 If dbObject is detached you will have to call
 entityManager.merge(dbObject) before committing the transaction.
 
 
 
 2013/6/14 Evgheni Emelianov e.emelia...@gmx.net
 
 Try first to refresh your entity with entitymanagerObject.refresh(), and
 use the return object for an update and then merge()
 
 Am 14.06.2013 um 10:14 schrieb Sven Meier s...@meiers.net:
 
 It depends whether your working with detached or manages entities. Are
 you using OSIV?
 
 Sven
 
 On 06/14/2013 12:22 AM, Boris Brinza wrote:
 Hello,
 ok, i understand what my problem was,
 I've update my code to use detachable model, quite easy refactorting.
 
 But it only postponed my problem to model onDetach, if i understand it
 right.
 In pdf, If we don't want to loose these changes we must explicitly
 persist the entity before the detaching phase occurs.
 So same problem with update of JPA enbtity. Insert is ok, just call
 persist(), but update?
 
 
 
 On 06/13/2013 02:52 PM, Sven Meier wrote:
 Please read 9.6 Detachable models of the Wicket Free Guide and come
 back with your questions.
 
 Sven
 
 On 06/13/2013 01:20 PM, Boris Brinza wrote:
 Hello to all,
 I have some fundamental issues with integration of jpa into wicket.
 I develop web application using wicket 6 and JPA (eclipselink). Maybe
 next question is more JPA oriented, but nevertheless:
 
 Lets say i have
 class BaseDetailPageT extens BaseDO extends WebPage {
   protected T dbEntity;
 
 }
 
 where dbEntity is instance of jpa persisted object.
 BaseDetail page contains form for editing db entity using
 CompoundPropertyModel.
 
 After i open detail page, entity is read from DB and page is
 displayed (if edit button is pressed) or i create new instance of object
 (if add button is pressed).
 
 After submit, if i want to add new record, everything is clear, i
 call beginTX(), entityManager.persist(dbEntity), commitTX().
 
 But what about updating existing record?
 
 Every example for JPA shows some basic code like this:
 beginTX()
 dbObject.setXXX();
 dbObject.setYYY();
 commitTX()
 
 
 But how to integrate this into wicket form using compound property
 model?
 There is no such code for setting properties of db object, and jpa
 does not have anything like entityManager.update().
 
 Now i use hack (by my opinion it';s a hack)
 
 beginTX()
 entityManaget.detach(dbObject);
 entityManager.merge(dbObject)
 commitTX()
 
 but i am not sure, if it's right solution (or i'm almost sure it's
 not right attitude)
 
 Is there any tutorial how to integrate these frameworks, or some
 simple opensource project to check how it's solved?
 
 Thanks for any advice,
 Boris
 
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



wicket and JPA

2013-06-13 Thread Boris Brinza

Hello to all,
I have some fundamental issues with integration of jpa into wicket.
I develop web application using wicket 6 and JPA (eclipselink). Maybe 
next question is more JPA oriented, but nevertheless:


Lets say i have
class BaseDetailPageT extens BaseDO extends WebPage {
protected T dbEntity;

}

where dbEntity is instance of jpa persisted object.
BaseDetail page contains form for editing db entity using 
CompoundPropertyModel.


After i open detail page, entity is read from DB and page is displayed 
(if edit button is pressed) or i create new instance of object (if add 
button is pressed).


After submit, if i want to add new record, everything is clear, i call 
beginTX(), entityManager.persist(dbEntity), commitTX().


But what about updating existing record?

Every example for JPA shows some basic code like this:
beginTX()
dbObject.setXXX();
dbObject.setYYY();
commitTX()


But how to integrate this into wicket form using compound property model?
There is no such code for setting properties of db object, and jpa does 
not have anything like entityManager.update().


Now i use hack (by my opinion it';s a hack)

beginTX()
entityManaget.detach(dbObject);
entityManager.merge(dbObject)
commitTX()

but i am not sure, if it's right solution (or i'm almost sure it's not 
right attitude)


Is there any tutorial how to integrate these frameworks, or some simple 
opensource project to check how it's solved?


Thanks for any advice,
Boris




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: wicket and JPA

2013-06-13 Thread Sven Meier
Please read 9.6 Detachable models of the Wicket Free Guide and come 
back with your questions.


Sven

On 06/13/2013 01:20 PM, Boris Brinza wrote:

Hello to all,
I have some fundamental issues with integration of jpa into wicket.
I develop web application using wicket 6 and JPA (eclipselink). Maybe 
next question is more JPA oriented, but nevertheless:


Lets say i have
class BaseDetailPageT extens BaseDO extends WebPage {
protected T dbEntity;

}

where dbEntity is instance of jpa persisted object.
BaseDetail page contains form for editing db entity using 
CompoundPropertyModel.


After i open detail page, entity is read from DB and page is displayed 
(if edit button is pressed) or i create new instance of object (if add 
button is pressed).


After submit, if i want to add new record, everything is clear, i call 
beginTX(), entityManager.persist(dbEntity), commitTX().


But what about updating existing record?

Every example for JPA shows some basic code like this:
beginTX()
dbObject.setXXX();
dbObject.setYYY();
commitTX()


But how to integrate this into wicket form using compound property model?
There is no such code for setting properties of db object, and jpa 
does not have anything like entityManager.update().


Now i use hack (by my opinion it';s a hack)

beginTX()
entityManaget.detach(dbObject);
entityManager.merge(dbObject)
commitTX()

but i am not sure, if it's right solution (or i'm almost sure it's not 
right attitude)


Is there any tutorial how to integrate these frameworks, or some 
simple opensource project to check how it's solved?


Thanks for any advice,
Boris




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: wicket and JPA

2013-06-13 Thread Boris Brinza

Hello,
ok, i understand what my problem was,
I've update my code to use detachable model, quite easy refactorting.

But it only postponed my problem to model onDetach, if i understand it 
right.
In pdf, If we don't want to loose these changes we must explicitly 
persist the entity before the detaching phase occurs.
So same problem with update of JPA enbtity. Insert is ok, just call 
persist(), but update?




On 06/13/2013 02:52 PM, Sven Meier wrote:
Please read 9.6 Detachable models of the Wicket Free Guide and come 
back with your questions.


Sven

On 06/13/2013 01:20 PM, Boris Brinza wrote:

Hello to all,
I have some fundamental issues with integration of jpa into wicket.
I develop web application using wicket 6 and JPA (eclipselink). Maybe 
next question is more JPA oriented, but nevertheless:


Lets say i have
class BaseDetailPageT extens BaseDO extends WebPage {
protected T dbEntity;

}

where dbEntity is instance of jpa persisted object.
BaseDetail page contains form for editing db entity using 
CompoundPropertyModel.


After i open detail page, entity is read from DB and page is 
displayed (if edit button is pressed) or i create new instance of 
object (if add button is pressed).


After submit, if i want to add new record, everything is clear, i 
call beginTX(), entityManager.persist(dbEntity), commitTX().


But what about updating existing record?

Every example for JPA shows some basic code like this:
beginTX()
dbObject.setXXX();
dbObject.setYYY();
commitTX()


But how to integrate this into wicket form using compound property 
model?
There is no such code for setting properties of db object, and jpa 
does not have anything like entityManager.update().


Now i use hack (by my opinion it';s a hack)

beginTX()
entityManaget.detach(dbObject);
entityManager.merge(dbObject)
commitTX()

but i am not sure, if it's right solution (or i'm almost sure it's 
not right attitude)


Is there any tutorial how to integrate these frameworks, or some 
simple opensource project to check how it's solved?


Thanks for any advice,
Boris




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




--

S pozdravom

Boris Brinza

---
HT Solution s.r.o.
Digital Park II
Einsteinova 25
851 01 Bratislava
Slovakia

Phone: +421 2 3500 2512,  Mobile: +421 903 602 126
E-mail: boris.bri...@htsolution.sk,  Internet: www.htsolution.sk


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: wicket and JPA

2013-06-13 Thread Andrey V. Panov
Check if entityManager.merge(entity) is present?!


Re: Wicket with JPA and container managed transactions

2012-10-09 Thread Dieter Tremel
Am 08.10.2012 17:37, schrieb Martin Grigorov:
 The JNDI lookup just done for you in normal JavaEE setup as well.
 So I think your code is OK.

Thank you Martin for your useful answers.

I posted a little more generic solution of an AbstractEjbModel in my
blog in
http://hotchpotch-blog.de/2012/10/09/wrapping-eines-ejb-in-ein-loadabledetachablemodel/
(only in german language).

If I have some more time I will have a look at javaee-inject. That
solution of packing EJB into CDI bean I could not make run, perhaps my
code hasn't been smart enough in this tests.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Wicket with JPA and container managed transactions

2012-10-08 Thread Dieter Tremel
Moving from JSF to Wicket 6.1.0 I am used to having all JPA operations
in a EJB facade to use the container's (Glassfish 3.2.1) transaction
management. I use and know wicket-cdi for injection, which works fine.

Unfortunately, if I inject an EJB in a wicket page, the serialization
checks of wicket complain that it is not serializable. This is true for
EJB, I suppose since they are proxied by
EJBLocalObjectInvocationHandlerDelegate. Frustrated I have read the
thread around http://markmail.org/message/4esc7m5subft5ngu

My thinking is blocked at this point. If I can't use jpa with container
managed transactions wicket how is the simpliest way do achieve it? All
examples I googled and also these in the book Wicket in Action are
only reading data or using Spring, what I do not want to do.

Thank you for any hint
Dieter Tremel

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket with JPA and container managed transactions

2012-10-08 Thread Martin Grigorov
Hi,

Are you aware of
https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/javaee-inject-parent
?

https://github.com/wicketstuff/core/wiki/Java-EE-Inject

On Mon, Oct 8, 2012 at 4:05 PM, Dieter Tremel tre...@tremel-computer.de wrote:
 Moving from JSF to Wicket 6.1.0 I am used to having all JPA operations
 in a EJB facade to use the container's (Glassfish 3.2.1) transaction
 management. I use and know wicket-cdi for injection, which works fine.

 Unfortunately, if I inject an EJB in a wicket page, the serialization
 checks of wicket complain that it is not serializable. This is true for
 EJB, I suppose since they are proxied by
 EJBLocalObjectInvocationHandlerDelegate. Frustrated I have read the
 thread around http://markmail.org/message/4esc7m5subft5ngu

 My thinking is blocked at this point. If I can't use jpa with container
 managed transactions wicket how is the simpliest way do achieve it? All
 examples I googled and also these in the book Wicket in Action are
 only reading data or using Spring, what I do not want to do.

 Thank you for any hint
 Dieter Tremel

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket with JPA and container managed transactions

2012-10-08 Thread heapifyman
As far as I understood you have two possibilities:
1. Inject your EJB into a CDI component and inject that component into your
wicket pages using @Inject annotation. That should solve the serialization
problem but you will have an additional layer.
2. Use javaee-inject from wicketstuff [1] to inject your EJBs with @EJB
annotation into your wicket pages.

I've tried the second approach (though in JBoss, not glassfish) and so
far have had no problems with using both wicket-cdi and javaee-inject in
the same project. Maybe it's not so nice because you have to include two
dependencies and use two different kinds of annotations in your wicket
pages.

[1] https://github.com/wicketstuff/core/wiki/Java-EE-Inject


2012/10/8 Dieter Tremel tre...@tremel-computer.de

 Moving from JSF to Wicket 6.1.0 I am used to having all JPA operations
 in a EJB facade to use the container's (Glassfish 3.2.1) transaction
 management. I use and know wicket-cdi for injection, which works fine.

 Unfortunately, if I inject an EJB in a wicket page, the serialization
 checks of wicket complain that it is not serializable. This is true for
 EJB, I suppose since they are proxied by
 EJBLocalObjectInvocationHandlerDelegate. Frustrated I have read the
 thread around http://markmail.org/message/4esc7m5subft5ngu

 My thinking is blocked at this point. If I can't use jpa with container
 managed transactions wicket how is the simpliest way do achieve it? All
 examples I googled and also these in the book Wicket in Action are
 only reading data or using Spring, what I do not want to do.

 Thank you for any hint
 Dieter Tremel

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: Wicket with JPA and container managed transactions

2012-10-08 Thread Dieter Tremel
Am 08.10.2012 15:14, schrieb Martin Grigorov:
 Are you aware of
 https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/javaee-inject-parent
 ?

Hi Martin,
I know this lib an had a look at it. If I am right, it is just another
way of injection.
In my running example of implementing a data provider the injection
already works and a have a beautiful rendered result of my data. But
after the request the error around serialization is:
 SEVERE: Error serializing object class 
 de.tremel_computer.buchbeispiel.wicket.BuecherPage [object=[Page class = 
 de.tremel_computer.buchbeispiel.wicket.BuecherPage, id = 0, render count = 1]]
 org.apache.wicket.core.util.io.SerializableChecker$WicketNotSerializableException:
  Unable to serialize class: 
 com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate
 Field hierarchy is:
   0 [class=de.tremel_computer.buchbeispiel.wicket.BuecherPage, path=0]
 private java.lang.Object org.apache.wicket.MarkupContainer.children 
 [class=[Ljava.lang.Object;]
   java.lang.Object org.apache.wicket.Component.data[2] 
 [class=org.apache.wicket.extensions.markup.html.repeater.data.table.DefaultDataTable,
  path=0:datatable]
 private java.lang.Object org.apache.wicket.MarkupContainer.children 
 [class=[Ljava.lang.Object;]
   java.lang.Object org.apache.wicket.Component.data[1] 
 [class=org.apache.wicket.markup.html.WebMarkupContainer, 
 path=0:datatable:body]
 private java.lang.Object 
 org.apache.wicket.MarkupContainer.children 
 [class=org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable$1,
  path=0:datatable:body:rows]
   private final 
 org.apache.wicket.markup.repeater.data.IDataProvider 
 org.apache.wicket.markup.repeater.data.DataViewBase.dataProvider 
 [class=de.tremel_computer.wicketcrud.modeling.EntityDataProvider]
 private 
 de.tremel_computer.wicketcrud.controller.AbstractFacade 
 de.tremel_computer.wicketcrud.modeling.EntityDataProvider.facade 
 [class=de.tremel_computer.buchbeispiel.jpa.facade.__EJB31_Generated__BuchFacade__IntfBean__]
   private 
 de.tremel_computer.buchbeispiel.jpa.facade.__EJB31_Generated__BuchFacade__Intf__
  
 de.tremel_computer.buchbeispiel.jpa.facade.__EJB31_Generated__BuchFacade__IntfBean__.__ejb31_delegate
  [class=$Proxy182]
 protected java.lang.reflect.InvocationHandler 
 java.lang.reflect.Proxy.h 
 [class=com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate] - 
 field that is not serializable

I suppose with javaee-inject-parent I would have the same error after
rendering.

Thank You
Dieter

-- 
Tremel Computerhttp://www.tremel-computer.de
Dieter Tremel  mailto:tre...@tremel-computer.de
Rebenring 16   Tel +49 871 9357080
84032 Altdorf  Fax +49 871 9357081

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket with JPA and container managed transactions

2012-10-08 Thread Martin Grigorov
Hi Dieter,

javaee-inject uses wicket-ioc and injects a serializable Proxy instead
of the EJB bean itself that was returned by the container. This is the
same as how Spring and Guice work.

See the response of heapifyman. The simplest would be use only CDI in
your Wicket code. Hide any usage of EJBs behind CDI.

On Mon, Oct 8, 2012 at 4:25 PM, Dieter Tremel tre...@tremel-computer.de wrote:
 Am 08.10.2012 15:14, schrieb Martin Grigorov:
 Are you aware of
 https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/javaee-inject-parent
 ?

 Hi Martin,
 I know this lib an had a look at it. If I am right, it is just another
 way of injection.
 In my running example of implementing a data provider the injection
 already works and a have a beautiful rendered result of my data. But
 after the request the error around serialization is:
 SEVERE: Error serializing object class 
 de.tremel_computer.buchbeispiel.wicket.BuecherPage [object=[Page class = 
 de.tremel_computer.buchbeispiel.wicket.BuecherPage, id = 0, render count = 
 1]]
 org.apache.wicket.core.util.io.SerializableChecker$WicketNotSerializableException:
  Unable to serialize class: 
 com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate
 Field hierarchy is:
   0 [class=de.tremel_computer.buchbeispiel.wicket.BuecherPage, path=0]
 private java.lang.Object org.apache.wicket.MarkupContainer.children 
 [class=[Ljava.lang.Object;]
   java.lang.Object org.apache.wicket.Component.data[2] 
 [class=org.apache.wicket.extensions.markup.html.repeater.data.table.DefaultDataTable,
  path=0:datatable]
 private java.lang.Object org.apache.wicket.MarkupContainer.children 
 [class=[Ljava.lang.Object;]
   java.lang.Object org.apache.wicket.Component.data[1] 
 [class=org.apache.wicket.markup.html.WebMarkupContainer, 
 path=0:datatable:body]
 private java.lang.Object 
 org.apache.wicket.MarkupContainer.children 
 [class=org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable$1,
  path=0:datatable:body:rows]
   private final 
 org.apache.wicket.markup.repeater.data.IDataProvider 
 org.apache.wicket.markup.repeater.data.DataViewBase.dataProvider 
 [class=de.tremel_computer.wicketcrud.modeling.EntityDataProvider]
 private 
 de.tremel_computer.wicketcrud.controller.AbstractFacade 
 de.tremel_computer.wicketcrud.modeling.EntityDataProvider.facade 
 [class=de.tremel_computer.buchbeispiel.jpa.facade.__EJB31_Generated__BuchFacade__IntfBean__]
   private 
 de.tremel_computer.buchbeispiel.jpa.facade.__EJB31_Generated__BuchFacade__Intf__
  
 de.tremel_computer.buchbeispiel.jpa.facade.__EJB31_Generated__BuchFacade__IntfBean__.__ejb31_delegate
  [class=$Proxy182]
 protected java.lang.reflect.InvocationHandler 
 java.lang.reflect.Proxy.h 
 [class=com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate] 
 - field that is not serializable

 I suppose with javaee-inject-parent I would have the same error after
 rendering.

 Thank You
 Dieter

 --
 Tremel Computerhttp://www.tremel-computer.de
 Dieter Tremel  mailto:tre...@tremel-computer.de
 Rebenring 16   Tel +49 871 9357080
 84032 Altdorf  Fax +49 871 9357081

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket with JPA and container managed transactions

2012-10-08 Thread Dieter Tremel
Am 08.10.2012 15:34, schrieb Martin Grigorov:
 javaee-inject uses wicket-ioc and injects a serializable Proxy instead
 of the EJB bean itself that was returned by the container. This is the
 same as how Spring and Guice work.
 
 See the response of heapifyman. The simplest would be use only CDI in
 your Wicket code. Hide any usage of EJBs behind CDI.

Thank You both for details, I will try some tests in both directions.
Dieter


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket with JPA and container managed transactions

2012-10-08 Thread Dieter Tremel
I found a different solution I would like to post for discussion:
I encapsulated the Facade in a LoadableDetachableModel like this:
 /**
  * Model for JPA facade beans.
  * @author Dieter Tremel tre...@tremel-computer.de
  */
 public class EntityFacadeModelE extends JPAEntity extends 
 LoadableDetachableModelAbstractFacadeE {
 
 private Class? extends JPAEntity entityClass;
 
 public EntityFacadeModel(Class? extends JPAEntity entityClass) {
 this.entityClass = entityClass;
 }
 
 @Override
 protected AbstractFacadeE load() {
 AbstractFacadeE result = null;
 try {
 InitialContext ctx = new InitialContext();
 result = (AbstractFacadeE) ctx.lookup(java:module/ + 
 entityClass.getSimpleName() + Facade);
 } catch (NamingException ex) {
 
 Logger.getLogger(EntityFacadeModel.class.getName()).log(Level.SEVERE, null, 
 ex);
 }
 return result;
 }
 }

I hope the JNDI lookup is a not too expensive operation, is it?

In the page I build this like:
 EntityDataProviderBuch buchProvider = new EntityDataProvider(new 
 EntityFacadeModelBuch(Buch.class));
 DefaultDataTableBuch, String dTable = new 
 DefaultDataTable(datatable, columns, buchProvider, 10);

And in the EntityDataProvider I have overwritten:
 @Override
 public void detach() {
 facadeModel.detach();
 super.detach();
 }

As a result there are no serialization errors in my trial. The lookup
will be called once per request.

What do you think?
Dieter


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket with JPA and container managed transactions

2012-10-08 Thread Martin Grigorov
Hi,

The JNDI lookup just done for you in normal JavaEE setup as well.
So I think your code is OK.

On Mon, Oct 8, 2012 at 6:24 PM, Dieter Tremel tre...@tremel-computer.de wrote:
 I found a different solution I would like to post for discussion:
 I encapsulated the Facade in a LoadableDetachableModel like this:
 /**
  * Model for JPA facade beans.
  * @author Dieter Tremel tre...@tremel-computer.de
  */
 public class EntityFacadeModelE extends JPAEntity extends 
 LoadableDetachableModelAbstractFacadeE {

 private Class? extends JPAEntity entityClass;

 public EntityFacadeModel(Class? extends JPAEntity entityClass) {
 this.entityClass = entityClass;
 }

 @Override
 protected AbstractFacadeE load() {
 AbstractFacadeE result = null;
 try {
 InitialContext ctx = new InitialContext();
 result = (AbstractFacadeE) ctx.lookup(java:module/ + 
 entityClass.getSimpleName() + Facade);
 } catch (NamingException ex) {
 
 Logger.getLogger(EntityFacadeModel.class.getName()).log(Level.SEVERE, null, 
 ex);
 }
 return result;
 }
 }

 I hope the JNDI lookup is a not too expensive operation, is it?

 In the page I build this like:
 EntityDataProviderBuch buchProvider = new EntityDataProvider(new 
 EntityFacadeModelBuch(Buch.class));
 DefaultDataTableBuch, String dTable = new 
 DefaultDataTable(datatable, columns, buchProvider, 10);

 And in the EntityDataProvider I have overwritten:
 @Override
 public void detach() {
 facadeModel.detach();
 super.detach();
 }

 As a result there are no serialization errors in my trial. The lookup
 will be called once per request.

 What do you think?
 Dieter


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket and JPA: iplease/i a simple way to go

2012-05-16 Thread hfriederichs

Tom Eugelink wrote
 
 For example, wicket convention dictates that all labels should be put in
 property files. I decided not to do that. I fully understand the
 advantages, but for this project I'm simply not going to add an additional
 label component and a property file just to get Name on the screen. Yes,
 if it must be internationalized I have to rework my code, but as it stands
 the application probably won't have to be, and I would have added the
 abstraction for nothing.
 
 

Tom,

Just an afterthought - I can't figure out the English word for the Dutch
'nabrander'. As it happens, my afterthought has to do with another
(non-existing) Dutch word: /hoevaakheid/. Translated to English you would
also get an non-existing word: /howoftenness/.
Maybe that's funny, maybe not. 
But apart from that, I think howoftenness is a very important and often
neglected concept. And your example is a perfect application of good use of
howoftenness.
How many 'layers of decoupling' have been written that turned out to be
useless... Had one only thought of howoftenness...

Hans

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4641067.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket and JPA: iplease/i a simple way to go

2012-05-16 Thread Martin Grigorov
On Wed, May 16, 2012 at 11:18 AM, hfriederichs h.friederi...@ohra.nl wrote:

 Tom Eugelink wrote

 For example, wicket convention dictates that all labels should be put in
 property files. I decided not to do that. I fully understand the
 advantages, but for this project I'm simply not going to add an additional
 label component and a property file just to get Name on the screen. Yes,
 if it must be internationalized I have to rework my code, but as it stands
 the application probably won't have to be, and I would have added the
 abstraction for nothing.



 Tom,

 Just an afterthought - I can't figure out the English word for the Dutch
 'nabrander'. As it happens, my afterthought has to do with another
 (non-existing) Dutch word: /hoevaakheid/. Translated to English you would
 also get an non-existing word: /howoftenness/.
 Maybe that's funny, maybe not.
 But apart from that, I think howoftenness is a very important and often
 neglected concept. And your example is a perfect application of good use of
 howoftenness.
 How many 'layers of decoupling' have been written that turned out to be
 useless... Had one only thought of howoftenness...

If you create an app with 2 pages then these layers look useless
indeed, but if you create a bigger app then you will see how all this
becomes useful.
You'll configure the layers once (it will take you a day or two) but
after that you will just inject the EntityManager and use it in PageN,
and this will return your initial investment.
Apart of that, doing manual transaction management is just silly.
Better let the layers to do this for you instead of spreading such
kind of logic all over your code.


 Hans

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4641067.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket and JPA: iplease/i a simple way to go

2012-05-16 Thread Tom Eugelink


On 16-5-2012 11:29, Martin Grigorov wrote:

On Wed, May 16, 2012 at 11:18 AM, hfriederichsh.friederi...@ohra.nl  wrote:

Just an afterthought - I can't figure out the English word for the Dutch
'nabrander'. As it happens, my afterthought has to do with another
(non-existing) Dutch word: /hoevaakheid/. Translated to English you would
also get an non-existing word: /howoftenness/.
Maybe that's funny, maybe not.
But apart from that, I think howoftenness is a very important and often
neglected concept. And your example is a perfect application of good use of
howoftenness.
How many 'layers of decoupling' have been written that turned out to be
useless... Had one only thought of howoftenness...

If you create an app with 2 pages then these layers look useless
indeed, but if you create a bigger app then you will see how all this
becomes useful.
You'll configure the layers once (it will take you a day or two) but
after that you will just inject the EntityManager and use it in PageN,
and this will return your initial investment.
Apart of that, doing manual transaction management is just silly.
Better let the layers to do this for you instead of spreading such
kind of logic all over your code.



In my opinion both are correct. Some layers need to be in from the start, because putting 
them in afterwards is a tremendous effort (e.g. separation of concern). Some layers 
should only be put in if the requirements actually requires them or it is reasonable to 
expect it to become a requirement (e.g. internationalization), or when the abstraction 
actually would be saving effort (spreading of code). For example: the need to type 
Name in the html and in the setLabel does IMHO not justify in the resource 
files abstraction. I'd also need to keep the ID for fetching the label in two locations 
in sync, which is the same effort. Or I would also need to add an additional abstraction 
by using a central list of java string constants.

Fetching an EM should happen only in one place, because that is most definitely 
a separate concern. But how complex that must be can evolve from a simple setup 
to quantum logic. I currently have a fetch EM logic in a Swing application that 
evolved to being based on open JFrames and active focus.

Topm


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket and JPA: iplease/i a simple way to go

2012-05-16 Thread Martin Grigorov
On Wed, May 16, 2012 at 11:42 AM, Tom Eugelink t...@tbee.org wrote:

 On 16-5-2012 11:29, Martin Grigorov wrote:

 On Wed, May 16, 2012 at 11:18 AM, hfriederichsh.friederi...@ohra.nl
  wrote:

 Just an afterthought - I can't figure out the English word for the Dutch

 'nabrander'. As it happens, my afterthought has to do with another
 (non-existing) Dutch word: /hoevaakheid/. Translated to English you would
 also get an non-existing word: /howoftenness/.
 Maybe that's funny, maybe not.
 But apart from that, I think howoftenness is a very important and often
 neglected concept. And your example is a perfect application of good use
 of
 howoftenness.
 How many 'layers of decoupling' have been written that turned out to be
 useless... Had one only thought of howoftenness...

 If you create an app with 2 pages then these layers look useless
 indeed, but if you create a bigger app then you will see how all this
 becomes useful.
 You'll configure the layers once (it will take you a day or two) but
 after that you will just inject the EntityManager and use it in PageN,
 and this will return your initial investment.
 Apart of that, doing manual transaction management is just silly.
 Better let the layers to do this for you instead of spreading such
 kind of logic all over your code.


 In my opinion both are correct. Some layers need to be in from the start,
 because putting them in afterwards is a tremendous effort (e.g. separation
 of concern). Some layers should only be put in if the requirements actually
 requires them or it is reasonable to expect it to become a requirement (e.g.
 internationalization), or when the abstraction actually would be saving

Using a resource bundle for i18n has this big benefit for me: all my
translations are in *one* place.
Even if I know in which component (either in Java or in HTML) I've put
some label now I will forget this useless knowledge after a few
months. Then I'll have to grep over my source to find where is it and
change it. And most probably you wont support that app forever.
It will be even more frustrating for the one after you.

By having them all in one file I can just open this file, search for
the term and change it. This way all places that use it will be
updated in one shot.

But this is your app... Ignore me.

 effort (spreading of code). For example: the need to type Name in the html
 and in the setLabel does IMHO not justify in the resource files abstraction.
 I'd also need to keep the ID for fetching the label in two locations in
 sync, which is the same effort. Or I would also need to add an additional
 abstraction by using a central list of java string constants.

 Fetching an EM should happen only in one place, because that is most
 definitely a separate concern. But how complex that must be can evolve from
 a simple setup to quantum logic. I currently have a fetch EM logic in a
 Swing application that evolved to being based on open JFrames and active
 focus.

 Topm



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket and JPA: iplease/i a simple way to go

2012-05-16 Thread Tom Eugelink


On 16-5-2012 11:52, Martin Grigorov wrote:


Using a resource bundle for i18n has this big benefit for me: all my
translations are in *one* place.


But if the app does not have translations as a requirement?



But this is your app... Ignore me.


That would be unfriendly :-)

Tom



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket and JPA: iplease/i a simple way to go

2012-05-16 Thread Martijn Dashorst
Just an FYI: there is no need to add Label's for internationalization
purposes per se:

wicket:message key=... /

will work wonders for this kind of stuff.

But I agree that for 5 users for an internal app where folks really
are dutch, even that would be overkill when compared to

label for=..Naam/label

Martijn

On Wed, May 16, 2012 at 12:01 PM, Tom Eugelink t...@tbee.org wrote:

 On 16-5-2012 11:52, Martin Grigorov wrote:


 Using a resource bundle for i18n has this big benefit for me: all my
 translations are in *one* place.


 But if the app does not have translations as a requirement?



 But this is your app... Ignore me.


 That would be unfriendly :-)

 Tom




 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket and JPA: iplease/i a simple way to go

2012-05-16 Thread hfriederichs

Martin Grigorov-4 wrote
 
 Apart of that, doing manual transaction management is just silly.
 Better let the layers to do this for you instead of spreading such
 kind of logic all over your code.
 

Martin,

I have that logic at one place in my little silly application, and it's
perfect for it's goal, without config thingies, and the chance of big
changes in the future are zero. So let's not talk of that, I'll give you
another example - this time on a huge scale. 
My company is, as I mentioned earlier on, a big fat insurance company. As
all other companies in this branch, we started some ten years ago with the
biggest layer of decoupling there is: a centralized SOA/ESB.
And it turned out to be an enormous fiasco, it overcomplicated things on a
huge scale and has cost millions and millions. (It did generate a lot of
interesting work for me and lots of colleagues, though.) 
And now we are dismantling it, and turning back to point-to-point solutions.
As a result, things are getting more stable every day... And no, we are not
experiencing the disadvantages of the 'spaghetti' of zillions of
point-to-point connections, because there aren't so many. And yes, it's
great that we're having less and less 'scattered' functionality, like hidden
business rules in vetro-actions.
To be short: we didn't need it, and we better had not done it.

Hans



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4641131.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket and JPA: iplease/i a simple way to go

2012-05-14 Thread hfriederichs
It isn't; the database requirements are. I expected to get that done in an
hour or so, so that I could quickly continue with the more advanced and
complex functions. In the end it cost me a day.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4632270.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



RE: Wicket and JPA: iplease/i a simple way to go

2012-05-13 Thread hfriederichs
All standards are equal, but some (like JPA) are more equal than others,
that's what you mean?

Well, a short look at the history of computing shows that technologies with
obvious and proven qualities, 
unanimously supported by experts, sometimes still don't survive. Other
qualities are needed...

In my company, JPA is the way to go.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4630088.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket and JPA: iplease/i a simple way to go

2012-05-13 Thread dhar_ar
Has your company heard of NOSQL?

JPA is a standard and I agree with most of it, but there are times when good ol 
iBatis is more straight forward.

Looking at the future there are non RDBMS related databases; JPA is the way to 
go depending on where you are going.

For a community building a framework, they have to consider the community and 
not just a single line of thought. 

If you still feel that a single stack of technologies that provides a 360 
degree coverage. Check out PLAY !

They have re invented the paridgm and are ready to even discard the servlet 
specification (or make it optional)

I don't like that aspect of Play, but looks like you may enjoy it more. Its 
nice for that I could critcize it.

Wicke ftw for the rest.
Good luck


Sent from BlackBerry® on Airtel

-Original Message-
From: hfriederichs h.friederi...@ohra.nl
Date: Sun, 13 May 2012 00:23:32 
To: users@wicket.apache.org
Reply-To: users@wicket.apache.org
Subject: RE: Wicket and JPA: iplease/i a simple way to go

All standards are equal, but some (like JPA) are more equal than others,
that's what you mean?

Well, a short look at the history of computing shows that technologies with
obvious and proven qualities, 
unanimously supported by experts, sometimes still don't survive. Other
qualities are needed...

In my company, JPA is the way to go.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4630088.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket and JPA: iplease/i a simple way to go

2012-05-13 Thread Tom Eugelink


Chiming in;

As it happens I'm currently working on a NoSQL (Cassandra) project and found a 
JPA implementation for Cassandra (http://code.google.com/p/kundera/). Currently 
JPA is the most used persistency API in Java, allowing for binding with RDBMS, 
XML, NoSQL. I decided not to use it, BTW, but that is because of other 
considerations.

To also have an quick opinion on the rest of the thread (as I understand it). Java 
projects have a tendency to over complicate and bloat. For example, wicket convention 
dictates that all labels should be put in property files. I decided not to do that. I 
fully understand the advantages, but for this project I'm simply not going to add an 
additional label component and a property file just to get Name on the 
screen. Yes, if it must be internationalized I have to rework my code, but as it stands 
the application probably won't have to be, and I would have added the abstraction for 
nothing.

Same goes for the 6 line JPA example a few posts back. If it works, great, just 
use it as is. Why make it more complex from the start? Refactor if you need to, 
not overarchitecture in advance.

I found that this pragmatic style (mind you; it's all a balance, you can't skip every corner), usually 
delivers results PHP style fast, but still has Java quality architecture in the 
overall setup. And even with all refactoring counted in, it stays well within budget; I'm currently aiming to 
complete my project in 75% of the Java architecture estimate. ;-)

Coming full circle; one of the corners you can't cut is clear separation of 
concern. So extracting the model (JPA) from the presentation (wicket) is very 
important.

My 2 euro cents. And thanks for a well though through framework, I'm warming up 
to it.

Tom


On 2012-05-13 09:51, dhar...@yahoo.com wrote:

Has your company heard of NOSQL?





-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket and JPA: iplease/i a simple way to go

2012-05-13 Thread hfriederichs
Tom,

I couldn't agree more, you hit the spot. Indeed it's all about balance,
don't over- (nor under-)architecture things. My application will be used by
maybe 5 people, and requires some very simple CRUD-implemetations on a
database table with maybe 100 rows (eventually).

Here's what I will do: stick the EntityManagerFactory in the
WicketApplication's subclass as Igor suggested (OK, without injection, but
never use injection for injection's sake); same goes for UserTransactions
for the CUD-part; make a DatabaseFacadeThing with all the necessary actions;
that thing uses the WicketApplication's subclass and will be used by the
Wicket components when needed. As a matter of fact, I already did make it,
and it works fine. And there's only the JPA-obligatory persistence.xml, no
other configs, components, and whatsoever.

Igor, thanks again for your 'dry swum code sample'. Btw: em.close() is not
allowed in a container-managed entity manager (JPA 5.9.1).

For all the other suggestions (not JPA): thank you, I will look at them,
just out of curiosity, because my 
company is a big, fat, obese insurance company, and big, fat, obese
creatures don't move a lot and don't like to move.
So it is JPA, and it will be so for ever and ever, in line with the
company's daily definition of 'ever and ever'.

Regards, Hans

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4630326.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket and JPA: iplease/i a simple way to go

2012-05-13 Thread James Carman
On Sun, May 13, 2012 at 7:19 AM, hfriederichs h.friederi...@ohra.nl wrote:
 Tom,

 I couldn't agree more, you hit the spot. Indeed it's all about balance,
 don't over- (nor under-)architecture things. My application will be used by
 maybe 5 people, and requires some very simple CRUD-implemetations on a
 database table with maybe 100 rows (eventually).

If your application is that simple, check out Wicketopia.  It might be
able to do a lot of what you need out of the box.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket and JPA: iplease/i a simple way to go

2012-05-13 Thread Tom Eugelink


On 2012-05-13 13:49, James Carman wrote:

If your application is that simple, check out Wicketopia.


Always interesting, but the information (http://wicketopia.sourceforge.net/) 
is, ah, lacking?  :-)

Tom


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket and JPA: iplease/i a simple way to go

2012-05-13 Thread James Carman
Patches and contributions are welcome.
On May 13, 2012 10:55 AM, Tom Eugelink t...@tbee.org wrote:


 On 2012-05-13 13:49, James Carman wrote:

 If your application is that simple, check out Wicketopia.


 Always interesting, but the information (http://wicketopia.**
 sourceforge.net/ http://wicketopia.sourceforge.net/) is, ah, lacking?
  :-)

 Tom


 --**--**-
 To unsubscribe, e-mail: 
 users-unsubscribe@wicket.**apache.orgusers-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: Wicket and JPA: iplease/i a simple way to go

2012-05-13 Thread James Carman
There is a sample application by the way. It'll give you a good idea of the
capabilities.
On May 13, 2012 12:18 PM, James Carman jcar...@carmanconsulting.com
wrote:

 Patches and contributions are welcome.
 On May 13, 2012 10:55 AM, Tom Eugelink t...@tbee.org wrote:


 On 2012-05-13 13:49, James Carman wrote:

 If your application is that simple, check out Wicketopia.


 Always interesting, but the information (http://wicketopia.**
 sourceforge.net/ http://wicketopia.sourceforge.net/) is, ah, lacking?
  :-)

 Tom


 --**--**-
 To unsubscribe, e-mail: 
 users-unsubscribe@wicket.**apache.orgusers-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: Wicket and JPA: iplease/i a simple way to go

2012-05-13 Thread Tom Eugelink

Where? I get almost empty pages.


   About Wicketopia Example Application

A Rapid Application Development (RAD) library for the Apache Wicket framework




On 2012-05-13 18:44, James Carman wrote:

There is a sample application by the way. It'll give you a good idea of the
capabilities.
On May 13, 2012 12:18 PM, James Carmanjcar...@carmanconsulting.com
wrote:


Patches and contributions are welcome.
On May 13, 2012 10:55 AM, Tom Eugelinkt...@tbee.org  wrote:


On 2012-05-13 13:49, James Carman wrote:


If your application is that simple, check out Wicketopia.


Always interesting, but the information (http://wicketopia.**
sourceforge.net/http://wicketopia.sourceforge.net/) is, ah, lacking?
  :-)

Tom


--**--**-
To unsubscribe, e-mail: 
users-unsubscribe@wicket.**apache.orgusers-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org






Re: Wicket and JPA: iplease/i a simple way to go

2012-05-13 Thread James Carman
Use the source, Luke!  The code is hosted at github currently.

https://github.com/jwcarman/Wicketopia
On May 13, 2012 1:07 PM, Tom Eugelink t...@tbee.org wrote:

 Where? I get almost empty pages.


   About Wicketopia Example Application

 A Rapid Application Development (RAD) library for the Apache Wicket
 framework




 On 2012-05-13 18:44, James Carman wrote:

 There is a sample application by the way. It'll give you a good idea of
 the
 capabilities.
 On May 13, 2012 12:18 PM, James 
 Carmanjcarman@**carmanconsulting.comjcar...@carmanconsulting.com
 
 wrote:

  Patches and contributions are welcome.
 On May 13, 2012 10:55 AM, Tom Eugelinkt...@tbee.org  wrote:

  On 2012-05-13 13:49, James Carman wrote:

  If your application is that simple, check out Wicketopia.

  Always interesting, but the information (http://wicketopia.**
 sourceforge.net/http://**wicketopia.sourceforge.net/http://wicketopia.sourceforge.net/)
 is, ah, lacking?
  :-)

 Tom


 --**
 --**-
 To unsubscribe, e-mail: 
 users-unsubscribe@wicket.**apa**che.orghttp://apache.org
 users-unsubscribe@**wicket.apache.orgusers-unsubscr...@wicket.apache.org
 
 For additional commands, e-mail: users-h...@wicket.apache.org






Wicket and JPA: iplease/i a simple way to go

2012-05-12 Thread hfriederichs
Hello,

I'm using wicket 1.5.4, and I tried various approaches in using Wicket and
JPA (using webshere/open jpa). I looked at several posts here, but I keep
ending up writing /more/ boiler plate code and configuration than with plain
old jdbc.
So.
I don't want to write factories. I don't want to write Managers. I don't
want to use Guice. I'd like to inject an EntityManager, but there's no
Servlet, and injecting it in a ServletContextListener obviously doesn't
work.
If your response is like: look at this forum for '' please don't
respond.

Please help 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket and JPA: iplease/i a simple way to go

2012-05-12 Thread Josh Kamau
You dont want to use cdi either?

On 12 May 2012 12:22, hfriederichs h.friederi...@ohra.nl wrote:

Hello,

I'm using wicket 1.5.4, and I tried various approaches in using Wicket and
JPA (using webshere/open jpa). I looked at several posts here, but I keep
ending up writing /more/ boiler plate code and configuration than with plain
old jdbc.
So.
I don't want to write factories. I don't want to write Managers. I don't
want to use Guice. I'd like to inject an EntityManager, but there's no
Servlet, and injecting it in a ServletContextListener obviously doesn't
work.
If your response is like: look at this forum for '' please don't
respond.

Please help

--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Re: Wicket and JPA: iplease/i a simple way to go

2012-05-12 Thread hfriederichs
I looked at it, shortly. It's a perfect example of what I mean. I looked at a
blog by Igor V. And there we go again: you have to do this; and than that.
And then configure this. And don't forget to add a line in xml.
And in the end, put it all together and it's so great. 

I don't think so. 

I think JPA has to make life easier, and it does for me when I'm not using
Wicket: inject an EntityManager and do my db-stuff. That's how it should be,
IMHO.

Of course, the CDI-blog goes with the usual great-gratitude-comments of
developers who couldn't figure it out either.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4628598.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket and JPA: iplease/i a simple way to go

2012-05-12 Thread Josh Kamau
Use ebean then. Www.avaje.org  . You just add 1 properties file and you can
start persisting your jpa  entities

On 12 May 2012 12:58, hfriederichs h.friederi...@ohra.nl wrote:

I looked at it, shortly. It's a perfect example of what I mean. I looked at
a
blog by Igor V. And there we go again: you have to do this; and than that.
And then configure this. And don't forget to add a line in xml.
And in the end, put it all together and it's so great.

I don't think so.

I think JPA has to make life easier, and it does for me when I'm not using
Wicket: inject an EntityManager and do my db-stuff. That's how it should be,
IMHO.

Of course, the CDI-blog goes with the usual great-gratitude-comments of
developers who couldn't figure it out either.

--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4628598.html

Sent from the Users forum mailing list archive at Nabble.com.

-...


Re: Wicket and JPA: iplease/i a simple way to go

2012-05-12 Thread Igor Vaynberg
On Sat, May 12, 2012 at 2:58 AM, hfriederichs h.friederi...@ohra.nl wrote:
 I looked at it, shortly. It's a perfect example of what I mean. I looked at a
 blog by Igor V. And there we go again: you have to do this; and than that.
 And then configure this. And don't forget to add a line in xml.
 And in the end, put it all together and it's so great.

my blog explains how to create an application architecture based on
conversations. once its set up you dont have to touch it again and it
makes life much simpler whether you are using wicket or not. very
little of the article has to do with wicket itself.

 I don't think so.

thats nice.

 I think JPA has to make life easier, and it does for me when I'm not using
 Wicket: inject an EntityManager and do my db-stuff. That's how it should be,
 IMHO.

when you are not using it with wicket what are you using it with?
websphere and servlets? sounds like websphere is using JEE to manage
jpa for you, so use wicket-jee module in wicketstuff. it will allow
you to inject the EntityManager into wicket components.

-igor


 Of course, the CDI-blog goes with the usual great-gratitude-comments of
 developers who couldn't figure it out either.

whats wrong with that?

-igor

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4628598.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket and JPA: iplease/i a simple way to go

2012-05-12 Thread hfriederichs
Igor, 

Josh suggested CDI as an alternative, in that respect it's the same as other
approaches I've tried: to cumbersome, to complex for my goals, so in respect
to what I want I don't think it's great.

I'll look into the wicket-jee module in wicketstuff, but it is yet another
extra 'thingy' you need for something that's so simple and basic... I wonder
if anyone has ever coined the phrase 'boiler plate xml' or 'boiler plate
components'. Maybe a quiz is a good idea. The Question is: fetch one row
from a straightforward table in let's say an onclick of a wicket button,
using jpa. The respondent that has the simplest solution gets eternal fame.

 Of course, the CDI-blog goes with the usual great-gratitude-comments of
 developers who couldn't figure it out either.

 whats wrong with that?

Who says there's something wrong with that? It's just irony.

Thanks anyways

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4629186.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket and JPA: iplease/i a simple way to go

2012-05-12 Thread James Carman
Wicket core tries to stay stack agnostic.  If you want technology
specific stuff, you have to use extra modules.
On May 12, 2012 1:23 PM, hfriederichs h.friederi...@ohra.nl wrote:

 Igor,

 Josh suggested CDI as an alternative, in that respect it's the same as
 other
 approaches I've tried: to cumbersome, to complex for my goals, so in
 respect
 to what I want I don't think it's great.

 I'll look into the wicket-jee module in wicketstuff, but it is yet another
 extra 'thingy' you need for something that's so simple and basic... I
 wonder
 if anyone has ever coined the phrase 'boiler plate xml' or 'boiler plate
 components'. Maybe a quiz is a good idea. The Question is: fetch one row
 from a straightforward table in let's say an onclick of a wicket button,
 using jpa. The respondent that has the simplest solution gets eternal fame.

  Of course, the CDI-blog goes with the usual great-gratitude-comments of
  developers who couldn't figure it out either.

  whats wrong with that?

 Who says there's something wrong with that? It's just irony.

 Thanks anyways

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4629186.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: Wicket and JPA: iplease/i a simple way to go

2012-05-12 Thread hfriederichs
James, what is technology specific about JPA?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4629309.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket and JPA: iplease/i a simple way to go

2012-05-12 Thread James Carman
What if people want to use Hibernate?  What if people want to use
Cayenne?  What if people want to use iBatis/myBatis?  What if folks
want to use just plain ole JDBC?

The point is that the core of Wicket tries to stay as uncluttered as
possible, relying upon add-on modules to adapt it to other
environments (such as JEE like you're used to).  I would suggest you
take a look at the examples folks are showing you and play with them.
I think you'll find that the boilerplate stuff you have to do drops
off considerably after you get things working the way you want.  There
are even maven archetypes out there (legup is one I think others are
using) to help you get a fully working version set up in no time.

On Sat, May 12, 2012 at 3:05 PM, hfriederichs h.friederi...@ohra.nl wrote:
 James, what is technology specific about JPA?

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4629309.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket and JPA: iplease/i a simple way to go

2012-05-12 Thread Igor Vaynberg
On Sat, May 12, 2012 at 10:23 AM, hfriederichs h.friederi...@ohra.nl wrote:
 Igor,

 Josh suggested CDI as an alternative, in that respect it's the same as other
 approaches I've tried: to cumbersome, to complex for my goals, so in respect
 to what I want I don't think it's great.

 I'll look into the wicket-jee module in wicketstuff, but it is yet another
 extra 'thingy' you need for something that's so simple and basic... I wonder
 if anyone has ever coined the phrase 'boiler plate xml' or 'boiler plate
 components'. Maybe a quiz is a good idea. The Question is: fetch one row
 from a straightforward table in let's say an onclick of a wicket button,
 using jpa. The respondent that has the simplest solution gets eternal fame.

class JpaApplication extends WebApplication {
  EntityManagerFactory jpa;

  init() {  super.init(); jpa=Persistence.createEntityManagerFactory(demo); }
  static JpaApplication get() { return (JpaApplication)application.get(); }
  EntityManager createEm() { return jpa.craeteEntityManager(); }
}

class MyPage extends WebPage {
  MyPage() {
 add(new Button(fetch) {
onsubmit() {
   EntityManager em=JpaApplication.get().createEm();
   em.createQuery(FROM foo).setMaxResults(1).getResultList();
   em.close();
}
});}}

there you go. of course by the time you are done adapting this super
simple yet working example to something usable in an actual
application you will end up with something i described in my blog.

-igor


 Of course, the CDI-blog goes with the usual great-gratitude-comments of
 developers who couldn't figure it out either.

 whats wrong with that?

 Who says there's something wrong with that? It's just irony.

 Thanks anyways

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4629186.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket and JPA: iplease/i a simple way to go

2012-05-12 Thread hfriederichs
I have things working, in two versions: one with a
'PersistenceManagerSingleton' I wrote, ugly, and one based on jndi-lookups
of both the EntityManager and the UserTransaction, ugly too, for sticking to
jndi-lookups. A third I am thinking of is create an EJB-project alongside my
WebModule, so I can do my Injection stuff there. A fourth could be the
wicketstuff JEE-module.

I think you're missing my point. It doesn´t matter that there are loads of
examples. As I see it, they are all far too complex for such simple a task.

And I think I´m missing your point: I still don't get what's technology
specific about JPA. Isn't it just a Java API like JMS or JaxWS?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4629356.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket and JPA: iplease/i a simple way to go

2012-05-12 Thread James Carman
On Sat, May 12, 2012 at 3:42 PM, hfriederichs h.friederi...@ohra.nl wrote:
 And I think I´m missing your point: I still don't get what's technology
 specific about JPA. Isn't it just a Java API like JMS or JaxWS?


Yes, JPA is *an* API, but it's not the only persistence API out there.
 If Wicket were to pick a favorite, then of course there would be
folks out there that wouldn't like it.  So, it doesn't.  However,
there are plenty of add-on modules for you to choose from that make it
much easier for you to use your API of choice.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket and JPA: iplease/i a simple way to go

2012-05-12 Thread hfriederichs
Igor,

I suspect you didn't realize when you got up this morning that at the end of
the day you would acquire eternal fame, but there it is. To get it working
with WebSphere is another matter; let's call it a challenge... 

I'll consider all the things mentioned here, thanks to you all.

Regards etc...

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4629413.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket and JPA: iplease/i a simple way to go

2012-05-12 Thread Igor Vaynberg
that example will work with websphere, or without it.

-igor

On Sat, May 12, 2012 at 1:15 PM, hfriederichs h.friederi...@ohra.nl wrote:
 Igor,

 I suspect you didn't realize when you got up this morning that at the end of
 the day you would acquire eternal fame, but there it is. To get it working
 with WebSphere is another matter; let's call it a challenge...

 I'll consider all the things mentioned here, thanks to you all.

 Regards etc...

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4629413.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



RE: Wicket and JPA: iplease/i a simple way to go

2012-05-12 Thread Chris Colman
James, what is technology specific about JPA?

You assume that because JPA is a standard it must be the only standard.
A lot of people would take offense to that.

Have you heard of JDO? It was around long before JPA, is much more
mature, still actively enhanced and many who use it do so because they
believe it to be superior because it wasn't written with the design goal
of 'constrain it sufficiently so that a popular ORM is capable of
implementing it'. That's why JDO can work with all the RDBMSes and the
NoSQLs, GAE, Mongo, OODBs etc.,


--
View this message in context: http://apache-
wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-
go-
tp4628562p4629309.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Wicket + spring + jpa/ hibernate = lazy load exception

2008-11-03 Thread JulianS

I am experiencing exactly the problem outlined in the subject of this post,
and I would really appreciate any help I can get, as I am under a deadline.
It's the first time I'm using Wicket with JPA, and I just don't understand
why this isn't working. 

I have a Wicket dataprovider that looks like this (I've simplified it a
bit):

public abstract class FooDataProvider extends SortableDataProvider
{
private static final long serialVersionUID = 1L;

@SpringBean
protected MyAPI myApi;

public FooDataProvider()
{
super();
// Injects the spring bean
InjectorHolder.getInjector().inject(this); 
}

public Iterator iterator(final int first, final int count)
{
ListBar bars = myApi.getBars();
ListFoo foos = bars.getFoos();
return foos.iterator();
}
}

I am using a very standard Spring JPA setup, and my web.xml includes a
OpenEntityManagerInViewFilter. The spring bean is being injected properly,
and my list of Bar is returned correctly. But I get a
LazyInitializationException no matter what I try. What am I doing wrong?

Many thanks,
Julian

-- 
View this message in context: 
http://www.nabble.com/wicket-%2B-spring-%2B-jpa--hibernate-%3D-lazy-load-exception-tp19721199p20308559.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Wicket + spring + jpa/ hibernate = lazy load exception

2008-11-03 Thread JulianS

Oops...I meant:

Bar bar = myApi.getBar();
ListFoo foos = bar.getFoos();


JulianS wrote:
 
 I am experiencing exactly the problem outlined in the subject of this
 post, and I would really appreciate any help I can get, as I am under a
 deadline. It's the first time I'm using Wicket with JPA, and I just don't
 understand why this isn't working. 
 
 I have a Wicket dataprovider that looks like this (I've simplified it a
 bit):
 
 public abstract class FooDataProvider extends SortableDataProvider
 {
   private static final long serialVersionUID = 1L;
 
   @SpringBean
   protected MyAPI myApi;
   
   public FooDataProvider()
   {
   super();
   // Injects the spring bean
   InjectorHolder.getInjector().inject(this); 
   }
 
   public Iterator iterator(final int first, final int count)
   {
   ListBar bars = myApi.getBars();
   ListFoo foos = bars.getFoos();
   return foos.iterator();
   }
 }
 
 I am using a very standard Spring JPA setup, and my web.xml includes a
 OpenEntityManagerInViewFilter. The spring bean is being injected properly,
 and my list of Bar is returned correctly. But I get a
 LazyInitializationException no matter what I try. What am I doing wrong?
 
 Many thanks,
 Julian
 
 

-- 
View this message in context: 
http://www.nabble.com/wicket-%2B-spring-%2B-jpa--hibernate-%3D-lazy-load-exception-tp19721199p20309299.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Wicket + spring + jpa/ hibernate = lazy load exception

2008-11-03 Thread James Perry
Firstly, your code is rather strange. That getFoos() method is not part of
the List Interface API.

Two possible solutions:

The filter chain maybe incorrect in your web.xml. Your
OpenEntityManagerInViewFilter might not be preceding the Wicket filter.
Check that it does precede it.

If you have a deadline then I recommend having one query that retrieving
both foos and bars in one hit. I've never touched JPQL but in Hibernate
Query Language (HQL), one could write this:

select f from Foo f inner join fetch f.boo b where b.id = :id

Good luck,
James.

On Mon, Nov 3, 2008 at 7:04 PM, JulianS [EMAIL PROTECTED] wrote:


 I am experiencing exactly the problem outlined in the subject of this post,
 and I would really appreciate any help I can get, as I am under a deadline.
 It's the first time I'm using Wicket with JPA, and I just don't understand
 why this isn't working.

 I have a Wicket dataprovider that looks like this (I've simplified it a
 bit):

 public abstract class FooDataProvider extends SortableDataProvider
 {
private static final long serialVersionUID = 1L;

@SpringBean
protected MyAPI myApi;

public FooDataProvider()
{
super();
// Injects the spring bean
InjectorHolder.getInjector().inject(this);
}

public Iterator iterator(final int first, final int count)
{
ListBar bars = myApi.getBars();
ListFoo foos = bars.getFoos();
return foos.iterator();
}
 }

 I am using a very standard Spring JPA setup, and my web.xml includes a
 OpenEntityManagerInViewFilter. The spring bean is being injected properly,
 and my list of Bar is returned correctly. But I get a
 LazyInitializationException no matter what I try. What am I doing wrong?

 Many thanks,
 Julian

 --
 View this message in context:
 http://www.nabble.com/wicket-%2B-spring-%2B-jpa--hibernate-%3D-lazy-load-exception-tp19721199p20308559.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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




Re: Wicket + spring + jpa/ hibernate = lazy load exception

2008-11-03 Thread Igor Vaynberg
what is your dataprovider#model() look like? are you using a loadable
detachable model?

-igor

On Mon, Nov 3, 2008 at 11:04 AM, JulianS [EMAIL PROTECTED] wrote:

 I am experiencing exactly the problem outlined in the subject of this post,
 and I would really appreciate any help I can get, as I am under a deadline.
 It's the first time I'm using Wicket with JPA, and I just don't understand
 why this isn't working.

 I have a Wicket dataprovider that looks like this (I've simplified it a
 bit):

 public abstract class FooDataProvider extends SortableDataProvider
 {
private static final long serialVersionUID = 1L;

@SpringBean
protected MyAPI myApi;

public FooDataProvider()
{
super();
// Injects the spring bean
InjectorHolder.getInjector().inject(this);
}

public Iterator iterator(final int first, final int count)
{
ListBar bars = myApi.getBars();
ListFoo foos = bars.getFoos();
return foos.iterator();
}
 }

 I am using a very standard Spring JPA setup, and my web.xml includes a
 OpenEntityManagerInViewFilter. The spring bean is being injected properly,
 and my list of Bar is returned correctly. But I get a
 LazyInitializationException no matter what I try. What am I doing wrong?

 Many thanks,
 Julian

 --
 View this message in context: 
 http://www.nabble.com/wicket-%2B-spring-%2B-jpa--hibernate-%3D-lazy-load-exception-tp19721199p20308559.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 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]



Re: Wicket + spring + jpa/ hibernate = lazy load exception

2008-11-03 Thread JulianS

Igor,

I'm not using a loadable detachable model because I was hoping to get the
list of foos directly from the Bar object, as opposed to having a dedicated
dao method to get the list of foos, which seems to defeat the benefit of
using JPA's object chaining. To answer your question, here's my
implementation of dataprovider#model():

public IModel model(Object object)
{
return new Model((Serializable) object);
}

Of course, it's very possible I'm missing a fundamental point about loadable
detachable models...



igor.vaynberg wrote:
 
 what is your dataprovider#model() look like? are you using a loadable
 detachable model?
 
 -igor
 
 On Mon, Nov 3, 2008 at 11:04 AM, JulianS [EMAIL PROTECTED] wrote:

 I am experiencing exactly the problem outlined in the subject of this
 post,
 and I would really appreciate any help I can get, as I am under a
 deadline.
 It's the first time I'm using Wicket with JPA, and I just don't
 understand
 why this isn't working.

 I have a Wicket dataprovider that looks like this (I've simplified it a
 bit):

 public abstract class FooDataProvider extends SortableDataProvider
 {
private static final long serialVersionUID = 1L;

@SpringBean
protected MyAPI myApi;

public FooDataProvider()
{
super();
// Injects the spring bean
InjectorHolder.getInjector().inject(this);
}

public Iterator iterator(final int first, final int count)
{
ListBar bars = myApi.getBars();
ListFoo foos = bars.getFoos();
return foos.iterator();
}
 }

 I am using a very standard Spring JPA setup, and my web.xml includes a
 OpenEntityManagerInViewFilter. The spring bean is being injected
 properly,
 and my list of Bar is returned correctly. But I get a
 LazyInitializationException no matter what I try. What am I doing wrong?

 Many thanks,
 Julian

 --
 View this message in context:
 http://www.nabble.com/wicket-%2B-spring-%2B-jpa--hibernate-%3D-lazy-load-exception-tp19721199p20308559.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 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]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/wicket-%2B-spring-%2B-jpa--hibernate-%3D-lazy-load-exception-tp19721199p20310904.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Wicket + spring + jpa/ hibernate = lazy load exception

2008-11-03 Thread JulianS

James, thanks for your reply. I've checked that my
OpenEntityManagerInViewFilter precedes the Wicket filter. And my debug log
indeed shows that it seems to be opening and closing the entity manager
before and after the wicket filter runs. I'm hoping to avoid the type of
query you suggest, but I'm realizing I may need to resort to it.

Julian


msc65jap wrote:
 
 Firstly, your code is rather strange. That getFoos() method is not part of
 the List Interface API.
 
 Two possible solutions:
 
 The filter chain maybe incorrect in your web.xml. Your
 OpenEntityManagerInViewFilter might not be preceding the Wicket filter.
 Check that it does precede it.
 
 If you have a deadline then I recommend having one query that retrieving
 both foos and bars in one hit. I've never touched JPQL but in Hibernate
 Query Language (HQL), one could write this:
 
 select f from Foo f inner join fetch f.boo b where b.id = :id
 
 Good luck,
 James.
 
 On Mon, Nov 3, 2008 at 7:04 PM, JulianS [EMAIL PROTECTED] wrote:
 

 I am experiencing exactly the problem outlined in the subject of this
 post,
 and I would really appreciate any help I can get, as I am under a
 deadline.
 It's the first time I'm using Wicket with JPA, and I just don't
 understand
 why this isn't working.

 I have a Wicket dataprovider that looks like this (I've simplified it a
 bit):

 public abstract class FooDataProvider extends SortableDataProvider
 {
private static final long serialVersionUID = 1L;

@SpringBean
protected MyAPI myApi;

public FooDataProvider()
{
super();
// Injects the spring bean
InjectorHolder.getInjector().inject(this);
}

public Iterator iterator(final int first, final int count)
{
ListBar bars = myApi.getBars();
ListFoo foos = bars.getFoos();
return foos.iterator();
}
 }

 I am using a very standard Spring JPA setup, and my web.xml includes a
 OpenEntityManagerInViewFilter. The spring bean is being injected
 properly,
 and my list of Bar is returned correctly. But I get a
 LazyInitializationException no matter what I try. What am I doing wrong?

 Many thanks,
 Julian

 --
 View this message in context:
 http://www.nabble.com/wicket-%2B-spring-%2B-jpa--hibernate-%3D-lazy-load-exception-tp19721199p20308559.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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


 
 

-- 
View this message in context: 
http://www.nabble.com/wicket-%2B-spring-%2B-jpa--hibernate-%3D-lazy-load-exception-tp19721199p20310970.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Wicket + spring + jpa/ hibernate = lazy load exception

2008-11-03 Thread Igor Vaynberg
On Mon, Nov 3, 2008 at 2:09 PM, JulianS [EMAIL PROTECTED] wrote:

To answer your question, here's my
 implementation of dataprovider#model():

public IModel model(Object object)
{
return new Model((Serializable) object);
}

 Of course, it's very possible I'm missing a fundamental point about loadable
 detachable models...

yes, you are missing a very fundmental point about models and the
reason for your lazy init exception is that you are using Model. there
are quiet a lot of threads on this list that explain and show how to
fix your error. i suggest you search the archives, read the models
page on the wiki, and go to wicketinaction.com and search for smart
entitymodel.

-igor





 igor.vaynberg wrote:

 what is your dataprovider#model() look like? are you using a loadable
 detachable model?

 -igor

 On Mon, Nov 3, 2008 at 11:04 AM, JulianS [EMAIL PROTECTED] wrote:

 I am experiencing exactly the problem outlined in the subject of this
 post,
 and I would really appreciate any help I can get, as I am under a
 deadline.
 It's the first time I'm using Wicket with JPA, and I just don't
 understand
 why this isn't working.

 I have a Wicket dataprovider that looks like this (I've simplified it a
 bit):

 public abstract class FooDataProvider extends SortableDataProvider
 {
private static final long serialVersionUID = 1L;

@SpringBean
protected MyAPI myApi;

public FooDataProvider()
{
super();
// Injects the spring bean
InjectorHolder.getInjector().inject(this);
}

public Iterator iterator(final int first, final int count)
{
ListBar bars = myApi.getBars();
ListFoo foos = bars.getFoos();
return foos.iterator();
}
 }

 I am using a very standard Spring JPA setup, and my web.xml includes a
 OpenEntityManagerInViewFilter. The spring bean is being injected
 properly,
 and my list of Bar is returned correctly. But I get a
 LazyInitializationException no matter what I try. What am I doing wrong?

 Many thanks,
 Julian

 --
 View this message in context:
 http://www.nabble.com/wicket-%2B-spring-%2B-jpa--hibernate-%3D-lazy-load-exception-tp19721199p20308559.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 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]




 --
 View this message in context: 
 http://www.nabble.com/wicket-%2B-spring-%2B-jpa--hibernate-%3D-lazy-load-exception-tp19721199p20310904.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 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]



Re: wicket + spring + jpa/ hibernate = lazy load exception

2008-10-09 Thread Lutz Müller
It might work if you dont have any ajax on your page. otherwise each ajax call 
happens in a new request and causes your domain object to be retrieved from 
the database.
this way you lose every change made to your object. writing all changes to 
database before detaching can be an option, but then you might persist 
something to your datastore that is in the midst of being edited.
i would be glad to offer a solution to the problems i just brought up, but i 
am struggling with this problem ever since i started using wicket.

On Tuesday 30 September 2008 08:40:11 Nino Saturnino Martinez Vazquez Wael 
wrote:
 Yup the way that I do it too almost down to every line:)

 Michael Sparer wrote:
  When using the OSIV-filter the lazyload exception may only happen if the
  same entity is used among different requests ... sothat it gets detached
  from hibernate. have a look at
  http://talk-on-tech.blogspot.com/2008/05/custom-reuseable-loadabledetacha
 blemode.html ... that's the way we're doing it
 
  regards,
  Michael
 
  Korbinian Bachl - privat wrote:
   I think it could be something about
missing usage of loadabledetachable model..?
 
  not for me, as the original entity is pulled using an
  loadabledetachableModel via a SortedDataProvider :/
 
  if you look around, the all called solution for this is the
  OpenSessionInViewFilter and the usage of
  bean id=transactionManager
  class=org.springframework.orm.jpa.JpaTransactionManager
  for that (latter one is used by me, too)
 
  However, the OpenSessionInViewFilter will not work with wicket, even if
  mapped to /* in the web.xml
 
  Best,
 
  Korbinian
 
  Nino Saturnino Martinez Vazquez Wael schrieb:
  Hi Korbinian
 
  Im facing the same problems... I also use extended.. So gonna be great
  to see the outcome of this thread.. I think it could be something about
  missing usage of loadabledetachable model..?
 
  Korbinian Bachl - privat wrote:
  Hi,
 
  I'm currently struggling with the famous lazy load exception under
  spring + jpa with wicket.
 
  The problem is, in my case, that i pull an entity from the database
  using a spring-bean (@SpringBean) and JPA (hibernate). Then in the
  wicket class i need to walk the entity tree a bit, based on the needs
  of the user (preloading wont work, as i dont know the direction the
  user wants to walk and the whole entity tree is too complex to grab it
  all at once).
 
  If I use the Entity myEntity.getMyOtherConnectedEntity I get the lazy
  load exception (transaction already closed). So I tried to use the
  OpenSessionInViewFilter to solve this, but it just won't work - no
  reason why, as the error stays exactly the same.
 
  Currently I ended up using this:
  @PersistenceContext(type = PersistenceContextType.EXTENDED)
  private EntityManager em;
 
  However, I'm not sure if this is the way it is supposed to be?
  ( I read so far that this disables a big part of springs-transaction
  handling support but didnt see any impacts so far)
 
  Has anyone a different aproach/ solution for this using wicket +
  spring with JPA?
 
  Best,
 
  Korbinan
 
  PS: im on wicket 1.4-m3
 
  -
  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]
 
  -
  Michael Sparer
  http://talk-on-tech.blogspot.com



Re: wicket + spring + jpa/ hibernate = lazy load exception

2008-10-09 Thread Michael Sparer

you mean changing each property of an existing object by means of ajax? if
the object is serializable, clone the object and perform the changes on that
object ... if it isn't set the properties in your form and apply them
onsubmit ... or am I missing the point completely?


Lutz Müller wrote:
 
 It might work if you dont have any ajax on your page. otherwise each ajax
 call 
 happens in a new request and causes your domain object to be retrieved
 from 
 the database.
 this way you lose every change made to your object. writing all changes to 
 database before detaching can be an option, but then you might persist 
 something to your datastore that is in the midst of being edited.
 i would be glad to offer a solution to the problems i just brought up, but
 i 
 am struggling with this problem ever since i started using wicket.
 
 On Tuesday 30 September 2008 08:40:11 Nino Saturnino Martinez Vazquez Wael 
 wrote:
 Yup the way that I do it too almost down to every line:)

 Michael Sparer wrote:
  When using the OSIV-filter the lazyload exception may only happen if
 the
  same entity is used among different requests ... sothat it gets
 detached
  from hibernate. have a look at
 
 http://talk-on-tech.blogspot.com/2008/05/custom-reuseable-loadabledetacha
 blemode.html ... that's the way we're doing it
 
  regards,
  Michael
 
  Korbinian Bachl - privat wrote:
   I think it could be something about
missing usage of loadabledetachable model..?
 
  not for me, as the original entity is pulled using an
  loadabledetachableModel via a SortedDataProvider :/
 
  if you look around, the all called solution for this is the
  OpenSessionInViewFilter and the usage of
  bean id=transactionManager
  class=org.springframework.orm.jpa.JpaTransactionManager
  for that (latter one is used by me, too)
 
  However, the OpenSessionInViewFilter will not work with wicket, even
 if
  mapped to /* in the web.xml
 
  Best,
 
  Korbinian
 
  Nino Saturnino Martinez Vazquez Wael schrieb:
  Hi Korbinian
 
  Im facing the same problems... I also use extended.. So gonna be
 great
  to see the outcome of this thread.. I think it could be something
 about
  missing usage of loadabledetachable model..?
 
  Korbinian Bachl - privat wrote:
  Hi,
 
  I'm currently struggling with the famous lazy load exception under
  spring + jpa with wicket.
 
  The problem is, in my case, that i pull an entity from the database
  using a spring-bean (@SpringBean) and JPA (hibernate). Then in the
  wicket class i need to walk the entity tree a bit, based on the
 needs
  of the user (preloading wont work, as i dont know the direction the
  user wants to walk and the whole entity tree is too complex to grab
 it
  all at once).
 
  If I use the Entity myEntity.getMyOtherConnectedEntity I get the
 lazy
  load exception (transaction already closed). So I tried to use the
  OpenSessionInViewFilter to solve this, but it just won't work - no
  reason why, as the error stays exactly the same.
 
  Currently I ended up using this:
  @PersistenceContext(type = PersistenceContextType.EXTENDED)
  private EntityManager em;
 
  However, I'm not sure if this is the way it is supposed to be?
  ( I read so far that this disables a big part of springs-transaction
  handling support but didnt see any impacts so far)
 
  Has anyone a different aproach/ solution for this using wicket +
  spring with JPA?
 
  Best,
 
  Korbinan
 
  PS: im on wicket 1.4-m3
 
 
 -
  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]
 
  -
  Michael Sparer
  http://talk-on-tech.blogspot.com
 
 
 


-
Michael Sparer
http://talk-on-tech.blogspot.com
-- 
View this message in context: 
http://www.nabble.com/wicket-%2B-spring-%2B-jpa--hibernate-%3D-lazy-load-exception-tp19721199p19899635.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: wicket + spring + jpa/ hibernate = lazy load exception

2008-10-09 Thread Igor Vaynberg
maybe this will help

http://wicketinaction.com/2008/09/building-a-smart-entitymodel/

-igor

On Thu, Oct 9, 2008 at 7:02 AM, Michael Sparer [EMAIL PROTECTED] wrote:

 you mean changing each property of an existing object by means of ajax? if
 the object is serializable, clone the object and perform the changes on that
 object ... if it isn't set the properties in your form and apply them
 onsubmit ... or am I missing the point completely?


 Lutz Müller wrote:

 It might work if you dont have any ajax on your page. otherwise each ajax
 call
 happens in a new request and causes your domain object to be retrieved
 from
 the database.
 this way you lose every change made to your object. writing all changes to
 database before detaching can be an option, but then you might persist
 something to your datastore that is in the midst of being edited.
 i would be glad to offer a solution to the problems i just brought up, but
 i
 am struggling with this problem ever since i started using wicket.

 On Tuesday 30 September 2008 08:40:11 Nino Saturnino Martinez Vazquez Wael
 wrote:
 Yup the way that I do it too almost down to every line:)

 Michael Sparer wrote:
  When using the OSIV-filter the lazyload exception may only happen if
 the
  same entity is used among different requests ... sothat it gets
 detached
  from hibernate. have a look at
 
 http://talk-on-tech.blogspot.com/2008/05/custom-reuseable-loadabledetacha
 blemode.html ... that's the way we're doing it
 
  regards,
  Michael
 
  Korbinian Bachl - privat wrote:
   I think it could be something about
missing usage of loadabledetachable model..?
 
  not for me, as the original entity is pulled using an
  loadabledetachableModel via a SortedDataProvider :/
 
  if you look around, the all called solution for this is the
  OpenSessionInViewFilter and the usage of
  bean id=transactionManager
  class=org.springframework.orm.jpa.JpaTransactionManager
  for that (latter one is used by me, too)
 
  However, the OpenSessionInViewFilter will not work with wicket, even
 if
  mapped to /* in the web.xml
 
  Best,
 
  Korbinian
 
  Nino Saturnino Martinez Vazquez Wael schrieb:
  Hi Korbinian
 
  Im facing the same problems... I also use extended.. So gonna be
 great
  to see the outcome of this thread.. I think it could be something
 about
  missing usage of loadabledetachable model..?
 
  Korbinian Bachl - privat wrote:
  Hi,
 
  I'm currently struggling with the famous lazy load exception under
  spring + jpa with wicket.
 
  The problem is, in my case, that i pull an entity from the database
  using a spring-bean (@SpringBean) and JPA (hibernate). Then in the
  wicket class i need to walk the entity tree a bit, based on the
 needs
  of the user (preloading wont work, as i dont know the direction the
  user wants to walk and the whole entity tree is too complex to grab
 it
  all at once).
 
  If I use the Entity myEntity.getMyOtherConnectedEntity I get the
 lazy
  load exception (transaction already closed). So I tried to use the
  OpenSessionInViewFilter to solve this, but it just won't work - no
  reason why, as the error stays exactly the same.
 
  Currently I ended up using this:
  @PersistenceContext(type = PersistenceContextType.EXTENDED)
  private EntityManager em;
 
  However, I'm not sure if this is the way it is supposed to be?
  ( I read so far that this disables a big part of springs-transaction
  handling support but didnt see any impacts so far)
 
  Has anyone a different aproach/ solution for this using wicket +
  spring with JPA?
 
  Best,
 
  Korbinan
 
  PS: im on wicket 1.4-m3
 
 
 -
  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]
 
  -
  Michael Sparer
  http://talk-on-tech.blogspot.com





 -
 Michael Sparer
 http://talk-on-tech.blogspot.com
 --
 View this message in context: 
 http://www.nabble.com/wicket-%2B-spring-%2B-jpa--hibernate-%3D-lazy-load-exception-tp19721199p19899635.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 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]



Re: wicket + spring + jpa/ hibernate = lazy load exception

2008-10-09 Thread Nino Saturnino Martinez Vazquez Wael

Hi Lutz

I agree, there is something to this.. However it's not wicket related.. 
I know that Bjarni are hacking away at something, I've dicussed a few 
things with him.


I guess if you are creating entities then you can store your data in a 
temporary model... However Bjarni Gudmondurs thing(still under 
development, he will make post to his blog soon ) will remove the need 
for explicitly defining the temporary class. It follows the builder 
pattern and on the end of the form/wizard whatever you just call 
build... If you are editing stuff then a loadable detachable model 
should be okay if you just persist the changes on each request, if thats 
not okay. Because the editing needs to be confirmed first then you have 
to store your data in a temporary map or something and persist on 
submit.. Theres loads of different ways of handling this, with pros and 
cons. You could also put in an extended persistence context but there 
are performance/memory issues with this if you have too much data, and 
data will be persisted on the fly. But I actually like the fact that we 
get the lazy load exceptions. It tells us that we are not using 
detachable models and our entities have become stale...


Lutz Müller wrote:
It might work if you dont have any ajax on your page. otherwise each ajax call 
happens in a new request and causes your domain object to be retrieved from 
the database.
this way you lose every change made to your object. writing all changes to 
database before detaching can be an option, but then you might persist 
something to your datastore that is in the midst of being edited.
i would be glad to offer a solution to the problems i just brought up, but i 
am struggling with this problem ever since i started using wicket.


On Tuesday 30 September 2008 08:40:11 Nino Saturnino Martinez Vazquez Wael 
wrote:
  

Yup the way that I do it too almost down to every line:)

Michael Sparer wrote:


When using the OSIV-filter the lazyload exception may only happen if the
same entity is used among different requests ... sothat it gets detached
from hibernate. have a look at
http://talk-on-tech.blogspot.com/2008/05/custom-reuseable-loadabledetacha
blemode.html ... that's the way we're doing it

regards,
Michael

Korbinian Bachl - privat wrote:
  

 I think it could be something about
  missing usage of loadabledetachable model..?

not for me, as the original entity is pulled using an
loadabledetachableModel via a SortedDataProvider :/

if you look around, the all called solution for this is the
OpenSessionInViewFilter and the usage of
bean id=transactionManager
class=org.springframework.orm.jpa.JpaTransactionManager
for that (latter one is used by me, too)

However, the OpenSessionInViewFilter will not work with wicket, even if
mapped to /* in the web.xml

Best,

Korbinian

Nino Saturnino Martinez Vazquez Wael schrieb:


Hi Korbinian

Im facing the same problems... I also use extended.. So gonna be great
to see the outcome of this thread.. I think it could be something about
missing usage of loadabledetachable model..?

Korbinian Bachl - privat wrote:
  

Hi,

I'm currently struggling with the famous lazy load exception under
spring + jpa with wicket.

The problem is, in my case, that i pull an entity from the database
using a spring-bean (@SpringBean) and JPA (hibernate). Then in the
wicket class i need to walk the entity tree a bit, based on the needs
of the user (preloading wont work, as i dont know the direction the
user wants to walk and the whole entity tree is too complex to grab it
all at once).

If I use the Entity myEntity.getMyOtherConnectedEntity I get the lazy
load exception (transaction already closed). So I tried to use the
OpenSessionInViewFilter to solve this, but it just won't work - no
reason why, as the error stays exactly the same.

Currently I ended up using this:
@PersistenceContext(type = PersistenceContextType.EXTENDED)
private EntityManager em;

However, I'm not sure if this is the way it is supposed to be?
( I read so far that this disables a big part of springs-transaction
handling support but didnt see any impacts so far)

Has anyone a different aproach/ solution for this using wicket +
spring with JPA?

Best,

Korbinan

PS: im on wicket 1.4-m3

-
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]


-
Michael Sparer
http://talk-on-tech.blogspot.com
  



  


--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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



Re: wicket + spring + jpa/ hibernate = lazy load exception

2008-10-09 Thread Timo Rantalaiho
On Thu, 09 Oct 2008, Lutz Müller wrote:
 It might work if you dont have any ajax on your page. otherwise each ajax 
 call 
 happens in a new request and causes your domain object to be retrieved from 
 the database.
 this way you lose every change made to your object. writing all changes to 
 database before detaching can be an option, but then you might persist 
 something to your datastore that is in the midst of being edited.
 i would be glad to offer a solution to the problems i just brought up, but i 
 am struggling with this problem ever since i started using wicket.

The best is if you can use autosave and just persist everything
(valid) always. Often this (combined with undo when needed) is
also a good solution for the user.

If not, at least we are not using detachable models in places 
where editing needs to span several requests.

Other option would be to use separate data transfer object 
style form beans.

Best wishes,
Timo

-- 
Timo Rantalaiho   
Reaktor Innovations OyURL: http://www.ri.fi/ 

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



Re: wicket + spring + jpa/ hibernate = lazy load exception

2008-10-09 Thread James Carman
Are we talking about a wizard here?  What if you used something like this:

https://wicketopia.svn.sourceforge.net/svnroot/wicketopia/trunk/wicketopia/src/main/java/org/wicketopia/model/proxy/ProxyModelManager.java

Basically, the models cache their values until you call commit on
the ProxyModelManager.  So, you can do as many steps in the wizard as
you want and if you base your components on proxied models (that wrap
PropertyModels around a LoadableDetachableModel), then your object
will only be loaded from the database at the end (during the commit
of the proxy models) and you won't lose your edits.

On Thu, Oct 9, 2008 at 10:37 PM, Timo Rantalaiho [EMAIL PROTECTED] wrote:
 On Thu, 09 Oct 2008, Lutz Müller wrote:
 It might work if you dont have any ajax on your page. otherwise each ajax 
 call
 happens in a new request and causes your domain object to be retrieved from
 the database.
 this way you lose every change made to your object. writing all changes to
 database before detaching can be an option, but then you might persist
 something to your datastore that is in the midst of being edited.
 i would be glad to offer a solution to the problems i just brought up, but i
 am struggling with this problem ever since i started using wicket.

 The best is if you can use autosave and just persist everything
 (valid) always. Often this (combined with undo when needed) is
 also a good solution for the user.

 If not, at least we are not using detachable models in places
 where editing needs to span several requests.

 Other option would be to use separate data transfer object
 style form beans.

 Best wishes,
 Timo

 --
 Timo Rantalaiho
 Reaktor Innovations OyURL: http://www.ri.fi/ 

 -
 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]



Re: wicket + spring + jpa/ hibernate = lazy load exception

2008-09-30 Thread Nino Saturnino Martinez Vazquez Wael

Yup the way that I do it too almost down to every line:)

Michael Sparer wrote:

When using the OSIV-filter the lazyload exception may only happen if the same
entity is used among different requests ... sothat it gets detached from
hibernate. have a look at
http://talk-on-tech.blogspot.com/2008/05/custom-reuseable-loadabledetachablemode.html
... that's the way we're doing it

regards,
Michael

Korbinian Bachl - privat wrote:
  

 I think it could be something about
  missing usage of loadabledetachable model..?

not for me, as the original entity is pulled using an 
loadabledetachableModel via a SortedDataProvider :/


if you look around, the all called solution for this is the 
OpenSessionInViewFilter and the usage of
bean id=transactionManager 
class=org.springframework.orm.jpa.JpaTransactionManager

for that (latter one is used by me, too)

However, the OpenSessionInViewFilter will not work with wicket, even if 
mapped to /* in the web.xml


Best,

Korbinian




Nino Saturnino Martinez Vazquez Wael schrieb:


Hi Korbinian

Im facing the same problems... I also use extended.. So gonna be great 
to see the outcome of this thread.. I think it could be something about 
missing usage of loadabledetachable model..?






Korbinian Bachl - privat wrote:
  

Hi,

I'm currently struggling with the famous lazy load exception under 
spring + jpa with wicket.


The problem is, in my case, that i pull an entity from the database 
using a spring-bean (@SpringBean) and JPA (hibernate). Then in the 
wicket class i need to walk the entity tree a bit, based on the needs 
of the user (preloading wont work, as i dont know the direction the 
user wants to walk and the whole entity tree is too complex to grab it 
all at once).


If I use the Entity myEntity.getMyOtherConnectedEntity I get the lazy 
load exception (transaction already closed). So I tried to use the 
OpenSessionInViewFilter to solve this, but it just won't work - no 
reason why, as the error stays exactly the same.


Currently I ended up using this:
@PersistenceContext(type = PersistenceContextType.EXTENDED)
private EntityManager em;

However, I'm not sure if this is the way it is supposed to be?
( I read so far that this disables a big part of springs-transaction 
handling support but didnt see any impacts so far)


Has anyone a different aproach/ solution for this using wicket + 
spring with JPA?


Best,

Korbinan

PS: im on wicket 1.4-m3

-
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]







-
Michael Sparer
http://talk-on-tech.blogspot.com
  


--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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



wicket + spring + jpa/ hibernate = lazy load exception

2008-09-29 Thread Korbinian Bachl - privat

Hi,

I'm currently struggling with the famous lazy load exception under 
spring + jpa with wicket.


The problem is, in my case, that i pull an entity from the database 
using a spring-bean (@SpringBean) and JPA (hibernate). Then in the 
wicket class i need to walk the entity tree a bit, based on the needs of 
the user (preloading wont work, as i dont know the direction the user 
wants to walk and the whole entity tree is too complex to grab it all at 
once).


If I use the Entity myEntity.getMyOtherConnectedEntity I get the lazy 
load exception (transaction already closed). So I tried to use the 
OpenSessionInViewFilter to solve this, but it just won't work - no 
reason why, as the error stays exactly the same.


Currently I ended up using this:
@PersistenceContext(type = PersistenceContextType.EXTENDED)
private EntityManager em;

However, I'm not sure if this is the way it is supposed to be?
( I read so far that this disables a big part of springs-transaction 
handling support but didnt see any impacts so far)


Has anyone a different aproach/ solution for this using wicket + spring 
with JPA?


Best,

Korbinan

PS: im on wicket 1.4-m3

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



Re: wicket + spring + jpa/ hibernate = lazy load exception

2008-09-29 Thread Nino Saturnino Martinez Vazquez Wael

Hi Korbinian

Im facing the same problems... I also use extended.. So gonna be great 
to see the outcome of this thread.. I think it could be something about 
missing usage of loadabledetachable model..?






Korbinian Bachl - privat wrote:

Hi,

I'm currently struggling with the famous lazy load exception under 
spring + jpa with wicket.


The problem is, in my case, that i pull an entity from the database 
using a spring-bean (@SpringBean) and JPA (hibernate). Then in the 
wicket class i need to walk the entity tree a bit, based on the needs 
of the user (preloading wont work, as i dont know the direction the 
user wants to walk and the whole entity tree is too complex to grab it 
all at once).


If I use the Entity myEntity.getMyOtherConnectedEntity I get the lazy 
load exception (transaction already closed). So I tried to use the 
OpenSessionInViewFilter to solve this, but it just won't work - no 
reason why, as the error stays exactly the same.


Currently I ended up using this:
@PersistenceContext(type = PersistenceContextType.EXTENDED)
private EntityManager em;

However, I'm not sure if this is the way it is supposed to be?
( I read so far that this disables a big part of springs-transaction 
handling support but didnt see any impacts so far)


Has anyone a different aproach/ solution for this using wicket + 
spring with JPA?


Best,

Korbinan

PS: im on wicket 1.4-m3

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



--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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



Re: wicket + spring + jpa/ hibernate = lazy load exception

2008-09-29 Thread Korbinian Bachl - privat

I think it could be something about
 missing usage of loadabledetachable model..?

not for me, as the original entity is pulled using an 
loadabledetachableModel via a SortedDataProvider :/


if you look around, the all called solution for this is the 
OpenSessionInViewFilter and the usage of
bean id=transactionManager 
class=org.springframework.orm.jpa.JpaTransactionManager

for that (latter one is used by me, too)

However, the OpenSessionInViewFilter will not work with wicket, even if 
mapped to /* in the web.xml


Best,

Korbinian




Nino Saturnino Martinez Vazquez Wael schrieb:

Hi Korbinian

Im facing the same problems... I also use extended.. So gonna be great 
to see the outcome of this thread.. I think it could be something about 
missing usage of loadabledetachable model..?






Korbinian Bachl - privat wrote:

Hi,

I'm currently struggling with the famous lazy load exception under 
spring + jpa with wicket.


The problem is, in my case, that i pull an entity from the database 
using a spring-bean (@SpringBean) and JPA (hibernate). Then in the 
wicket class i need to walk the entity tree a bit, based on the needs 
of the user (preloading wont work, as i dont know the direction the 
user wants to walk and the whole entity tree is too complex to grab it 
all at once).


If I use the Entity myEntity.getMyOtherConnectedEntity I get the lazy 
load exception (transaction already closed). So I tried to use the 
OpenSessionInViewFilter to solve this, but it just won't work - no 
reason why, as the error stays exactly the same.


Currently I ended up using this:
@PersistenceContext(type = PersistenceContextType.EXTENDED)
private EntityManager em;

However, I'm not sure if this is the way it is supposed to be?
( I read so far that this disables a big part of springs-transaction 
handling support but didnt see any impacts so far)


Has anyone a different aproach/ solution for this using wicket + 
spring with JPA?


Best,

Korbinan

PS: im on wicket 1.4-m3

-
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]



Re: wicket + spring + jpa/ hibernate = lazy load exception

2008-09-29 Thread James Carman
On Mon, Sep 29, 2008 at 7:14 AM, Korbinian Bachl - privat
[EMAIL PROTECTED] wrote:

 However, the OpenSessionInViewFilter will not work with wicket, even if
 mapped to /* in the web.xml

Huh?  We use it and it works just fine.  By the way, have you tried
OpenEntityManagerInViewFilter if you're using JPA?

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



Re: wicket + spring + jpa/ hibernate = lazy load exception

2008-09-29 Thread Michael Sparer

When using the OSIV-filter the lazyload exception may only happen if the same
entity is used among different requests ... sothat it gets detached from
hibernate. have a look at
http://talk-on-tech.blogspot.com/2008/05/custom-reuseable-loadabledetachablemode.html
... that's the way we're doing it

regards,
Michael

Korbinian Bachl - privat wrote:
 
  I think it could be something about
   missing usage of loadabledetachable model..?
 
 not for me, as the original entity is pulled using an 
 loadabledetachableModel via a SortedDataProvider :/
 
 if you look around, the all called solution for this is the 
 OpenSessionInViewFilter and the usage of
 bean id=transactionManager 
 class=org.springframework.orm.jpa.JpaTransactionManager
 for that (latter one is used by me, too)
 
 However, the OpenSessionInViewFilter will not work with wicket, even if 
 mapped to /* in the web.xml
 
 Best,
 
 Korbinian
 
 
 
 
 Nino Saturnino Martinez Vazquez Wael schrieb:
 Hi Korbinian
 
 Im facing the same problems... I also use extended.. So gonna be great 
 to see the outcome of this thread.. I think it could be something about 
 missing usage of loadabledetachable model..?
 
 
 
 
 
 Korbinian Bachl - privat wrote:
 Hi,

 I'm currently struggling with the famous lazy load exception under 
 spring + jpa with wicket.

 The problem is, in my case, that i pull an entity from the database 
 using a spring-bean (@SpringBean) and JPA (hibernate). Then in the 
 wicket class i need to walk the entity tree a bit, based on the needs 
 of the user (preloading wont work, as i dont know the direction the 
 user wants to walk and the whole entity tree is too complex to grab it 
 all at once).

 If I use the Entity myEntity.getMyOtherConnectedEntity I get the lazy 
 load exception (transaction already closed). So I tried to use the 
 OpenSessionInViewFilter to solve this, but it just won't work - no 
 reason why, as the error stays exactly the same.

 Currently I ended up using this:
 @PersistenceContext(type = PersistenceContextType.EXTENDED)
 private EntityManager em;

 However, I'm not sure if this is the way it is supposed to be?
 ( I read so far that this disables a big part of springs-transaction 
 handling support but didnt see any impacts so far)

 Has anyone a different aproach/ solution for this using wicket + 
 spring with JPA?

 Best,

 Korbinan

 PS: im on wicket 1.4-m3

 -
 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]
 
 
 


-
Michael Sparer
http://talk-on-tech.blogspot.com
-- 
View this message in context: 
http://www.nabble.com/wicket-%2B-spring-%2B-jpa--hibernate-%3D-lazy-load-exception-tp19721199p19722521.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: wicket + spring + jpa/ hibernate = lazy load exception

2008-09-29 Thread Korbinian Bachl - privat

really? - I tried it but...

would you please be so nice and post the part of the web.xml where it is 
mapped and the corresponding part of the spring-application.xml ?


what wicket version are you on? what runtime (Tomcat 6?)?

Best,

Korbinian


James Carman schrieb:

On Mon, Sep 29, 2008 at 7:14 AM, Korbinian Bachl - privat
[EMAIL PROTECTED] wrote:


However, the OpenSessionInViewFilter will not work with wicket, even if
mapped to /* in the web.xml


Huh?  We use it and it works just fine.  By the way, have you tried
OpenEntityManagerInViewFilter if you're using JPA?

-
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]



Re: wicket + spring + jpa/ hibernate = lazy load exception

2008-09-29 Thread James Carman
We don't use JPA at work, but we use OSIV (we're using straight
hibernate).  Anyway, for the JPA configuration, you can look at:

https://wicketopia.svn.sourceforge.net/svnroot/wicketopia/trunk/jpa-archetype/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml


On Mon, Sep 29, 2008 at 7:57 AM, Korbinian Bachl - privat
[EMAIL PROTECTED] wrote:
 really? - I tried it but...

 would you please be so nice and post the part of the web.xml where it is
 mapped and the corresponding part of the spring-application.xml ?

 what wicket version are you on? what runtime (Tomcat 6?)?

 Best,

 Korbinian


 James Carman schrieb:

 On Mon, Sep 29, 2008 at 7:14 AM, Korbinian Bachl - privat
 [EMAIL PROTECTED] wrote:

 However, the OpenSessionInViewFilter will not work with wicket, even if
 mapped to /* in the web.xml

 Huh?  We use it and it works just fine.  By the way, have you tried
 OpenEntityManagerInViewFilter if you're using JPA?

 -
 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]



Re: wicket + spring + jpa/ hibernate = lazy load exception

2008-09-29 Thread Korbinian Bachl - privat

Hmm,

I copied it to web.xml, but result is:

2008-09-29 18:07:24,125 ERROR org.hibernate.LazyInitializationException 
- failed to lazily initialize a collection of role: 
de.xxx....xxx., no session or session was closed
org.hibernate.LazyInitializationException: failed to lazily initialize a 
collection of role: de.xxx....xxx., no session or 
session was closed
	at 
org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
	at 
org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
	at 
org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:97)

at org.hibernate.collection.PersistentSet.size(PersistentSet.java:139)
..

web.xml looks:

?xml version=1.0 encoding=UTF-8?
web-app xmlns=http://java.sun.com/xml/ns/j2ee;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;

 version=2.4

display-namewhiskas-application/display-name

listener 
listener-classorg.springframework.web.context.ContextLoaderListener/listener-class

/listener

listener 
listener-classorg.springframework.web.context.request.RequestContextListener/listener-class

/listener

!-- ##
  Filters
   ## --

!-- TEST --
filter
filter-nameOpenEntityManagerInViewFilter/filter-name 


filter-classorg.springframework.orm.jpa.support.OpenEntityManagerInViewFilter/filter-class
/filter


!-- Wicket Application --
filter
filter-nameWhiskasApplication/filter-name 
filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class

init-param
param-nameapplicationFactoryClassName/param-name 


param-valueorg.apache.wicket.spring.SpringWebApplicationFactory/param-value
/init-param

init-param
param-nameconfiguration/param-name
param-valuedeployment/param-value
/init-param
/filter

!-- ##
Filter Mappings
 ## --

filter-mapping
filter-nameOpenEntityManagerInViewFilter/filter-name
url-pattern/*/url-pattern
/filter-mapping


filter-mapping
filter-nameWhiskasApplication/filter-name
url-pattern/*/url-pattern
/filter-mapping


/web-app

so, what can be wrong there? - web.xml seems 100% fine to me. Is there 
anything that has to be put into the application.xml?


Best,

Korbinian


James Carman schrieb:

We don't use JPA at work, but we use OSIV (we're using straight
hibernate).  Anyway, for the JPA configuration, you can look at:

https://wicketopia.svn.sourceforge.net/svnroot/wicketopia/trunk/jpa-archetype/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml


On Mon, Sep 29, 2008 at 7:57 AM, Korbinian Bachl - privat
[EMAIL PROTECTED] wrote:

really? - I tried it but...

would you please be so nice and post the part of the web.xml where it is
mapped and the corresponding part of the spring-application.xml ?

what wicket version are you on? what runtime (Tomcat 6?)?

Best,

Korbinian


James Carman schrieb:

On Mon, Sep 29, 2008 at 7:14 AM, Korbinian Bachl - privat
[EMAIL PROTECTED] wrote:


However, the OpenSessionInViewFilter will not work with wicket, even if
mapped to /* in the web.xml

Huh?  We use it and it works just fine.  By the way, have you tried
OpenEntityManagerInViewFilter if you're using JPA?

-
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]



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



Re: wicket + spring + jpa/ hibernate = lazy load exception

2008-09-29 Thread James Carman
Would you be able to create a quickstart that exhibits this behavior?
If you want, you can use the JPA archetype in wicketopia (the code I
referenced) to set everything up for you automatically.

On Mon, Sep 29, 2008 at 12:21 PM, Korbinian Bachl - privat
[EMAIL PROTECTED] wrote:
 Hmm,

 I copied it to web.xml, but result is:

 2008-09-29 18:07:24,125 ERROR org.hibernate.LazyInitializationException -
 failed to lazily initialize a collection of role:
 de.xxx....xxx., no session or session was closed
 org.hibernate.LazyInitializationException: failed to lazily initialize a
 collection of role: de.xxx....xxx., no session or session
 was closed
at
 org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
at
 org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
at
 org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:97)
at
 org.hibernate.collection.PersistentSet.size(PersistentSet.java:139)
 ..

 web.xml looks:

 ?xml version=1.0 encoding=UTF-8?
 web-app xmlns=http://java.sun.com/xml/ns/j2ee;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;
 version=2.4

display-namewhiskas-application/display-name

listener
 listener-classorg.springframework.web.context.ContextLoaderListener/listener-class
/listener

listener
 listener-classorg.springframework.web.context.request.RequestContextListener/listener-class
/listener

!-- ##
  Filters
   ## --

!-- TEST --
filter
filter-nameOpenEntityManagerInViewFilter/filter-name
 filter-classorg.springframework.orm.jpa.support.OpenEntityManagerInViewFilter/filter-class
/filter


!-- Wicket Application --
filter
filter-nameWhiskasApplication/filter-name
 filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class
init-param
param-nameapplicationFactoryClassName/param-name
 param-valueorg.apache.wicket.spring.SpringWebApplicationFactory/param-value
/init-param

init-param
param-nameconfiguration/param-name
param-valuedeployment/param-value
/init-param
/filter

!-- ##
Filter Mappings
 ## --

filter-mapping
filter-nameOpenEntityManagerInViewFilter/filter-name
url-pattern/*/url-pattern
/filter-mapping


filter-mapping
filter-nameWhiskasApplication/filter-name
url-pattern/*/url-pattern
/filter-mapping


 /web-app

 so, what can be wrong there? - web.xml seems 100% fine to me. Is there
 anything that has to be put into the application.xml?

 Best,

 Korbinian


 James Carman schrieb:

 We don't use JPA at work, but we use OSIV (we're using straight
 hibernate).  Anyway, for the JPA configuration, you can look at:


 https://wicketopia.svn.sourceforge.net/svnroot/wicketopia/trunk/jpa-archetype/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml


 On Mon, Sep 29, 2008 at 7:57 AM, Korbinian Bachl - privat
 [EMAIL PROTECTED] wrote:

 really? - I tried it but...

 would you please be so nice and post the part of the web.xml where it is
 mapped and the corresponding part of the spring-application.xml ?

 what wicket version are you on? what runtime (Tomcat 6?)?

 Best,

 Korbinian


 James Carman schrieb:

 On Mon, Sep 29, 2008 at 7:14 AM, Korbinian Bachl - privat
 [EMAIL PROTECTED] wrote:

 However, the OpenSessionInViewFilter will not work with wicket, even if
 mapped to /* in the web.xml

 Huh?  We use it and it works just fine.  By the way, have you tried
 OpenEntityManagerInViewFilter if you're using JPA?

 -
 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]


 -
 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]



Re: wicket + spring + jpa reference example?

2008-08-07 Thread francisco treacy
wicket phonebook, yes. i had some trouble yesterday checking it out
from the repo, so i used the download link. but that version (1.2
iirc) is outdated. anyway everything works now :)

i just stumbled upon this:
http://wicketstuff.org/confluence/display/STUFFWIKI/Wicket-Iolite .
haven't tried it, though. but next time i will!

francisco

On Wed, Aug 6, 2008 at 11:34 PM, Ryan Gravener [EMAIL PROTECTED] wrote:
 Have you taken a look at wicket-phonebook?

 https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicket-phonebook/

 I have a demo project for wicket+hibernate+spring+flex+blazeds in the works,
 but it is far from perfect:
 http://code.google.com/p/wicket-flex-blazeds/

 On Wed, Aug 6, 2008 at 5:25 PM, francisco treacy [EMAIL PROTECTED]
 wrote:

 hi,

 i need to develop a project with wicket + spring + jpa. i'm not used
 lately to this setup, so i tried to build it up, not without some
 trouble.

 so my question here is: do you know a current good wicket + spring +
 jpa reference/example?

 earlier today i checked out qwicket, but there's some really odd
 problem that prevents the app to load (no exceptions thrown
 whatsoever). also wicket in action, but it is not built with jpa (just
 plain hibernate) and i cannot figure out the correct
 applicationContext.xml...

 thanks!

 francisco

 ps. argh, i just love my normal setup with wicket + guice + salve +
 warp-persist, no xml, works like a charm :)

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




 --
 Ryan Gravener
 http://twitter.com/ryangravener


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



Re: wicket + spring + jpa reference example?

2008-08-07 Thread shetc

Buy Wicket In Action from Manning Publishers -- it has a useful Wicket +
Spring + Hibernate example. Replace Hibernate with the JPA equivalents.
-- 
View this message in context: 
http://www.nabble.com/wicket-%2B-spring-%2B-jpa-reference-example--tp18859884p18876793.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: wicket + spring + jpa reference example?

2008-08-07 Thread francisco treacy
i bought it last year :) and it's excellent, btw. i just wanted a
quick no-brainer example and wicket-lolite could have been the perfect
answer. thanks

francisco

On Thu, Aug 7, 2008 at 8:25 PM, shetc [EMAIL PROTECTED] wrote:

 Buy Wicket In Action from Manning Publishers -- it has a useful Wicket +
 Spring + Hibernate example. Replace Hibernate with the JPA equivalents.
 --
 View this message in context: 
 http://www.nabble.com/wicket-%2B-spring-%2B-jpa-reference-example--tp18859884p18876793.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 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]



wicket + spring + jpa reference example?

2008-08-06 Thread francisco treacy
hi,

i need to develop a project with wicket + spring + jpa. i'm not used
lately to this setup, so i tried to build it up, not without some
trouble.

so my question here is: do you know a current good wicket + spring +
jpa reference/example?

earlier today i checked out qwicket, but there's some really odd
problem that prevents the app to load (no exceptions thrown
whatsoever). also wicket in action, but it is not built with jpa (just
plain hibernate) and i cannot figure out the correct
applicationContext.xml...

thanks!

francisco

ps. argh, i just love my normal setup with wicket + guice + salve +
warp-persist, no xml, works like a charm :)

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



Re: wicket + spring + jpa reference example?

2008-08-06 Thread francisco treacy
it's me again. minutes after the post i found my way out of that
applicationContext maze... but thanks anyway!

francisco

On Wed, Aug 6, 2008 at 11:25 PM, francisco treacy
[EMAIL PROTECTED] wrote:
 hi,

 i need to develop a project with wicket + spring + jpa. i'm not used
 lately to this setup, so i tried to build it up, not without some
 trouble.

 so my question here is: do you know a current good wicket + spring +
 jpa reference/example?

 earlier today i checked out qwicket, but there's some really odd
 problem that prevents the app to load (no exceptions thrown
 whatsoever). also wicket in action, but it is not built with jpa (just
 plain hibernate) and i cannot figure out the correct
 applicationContext.xml...

 thanks!

 francisco

 ps. argh, i just love my normal setup with wicket + guice + salve +
 warp-persist, no xml, works like a charm :)


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



Re: wicket + spring + jpa reference example?

2008-08-06 Thread Ryan Gravener
Have you taken a look at wicket-phonebook?

https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicket-phonebook/

I have a demo project for wicket+hibernate+spring+flex+blazeds in the works,
but it is far from perfect:
http://code.google.com/p/wicket-flex-blazeds/

On Wed, Aug 6, 2008 at 5:25 PM, francisco treacy [EMAIL PROTECTED]
 wrote:

 hi,

 i need to develop a project with wicket + spring + jpa. i'm not used
 lately to this setup, so i tried to build it up, not without some
 trouble.

 so my question here is: do you know a current good wicket + spring +
 jpa reference/example?

 earlier today i checked out qwicket, but there's some really odd
 problem that prevents the app to load (no exceptions thrown
 whatsoever). also wicket in action, but it is not built with jpa (just
 plain hibernate) and i cannot figure out the correct
 applicationContext.xml...

 thanks!

 francisco

 ps. argh, i just love my normal setup with wicket + guice + salve +
 warp-persist, no xml, works like a charm :)

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




-- 
Ryan Gravener
http://twitter.com/ryangravener


Wicket and JPA(EntityManager PersistenceContextType)?

2008-04-02 Thread Nino Saturnino Martinez Vazquez Wael

I know this is not completely related. But here goes anyway.

I have an application with several different flows. If I switch from 
extended to transaction, suddenly the values in my form aren't save to 
the database(but they are saved in memory), I use spring to instantiate 
entitymanager and inject. It's very strange that it does not work.


I believe that the difference between expanded and transaction based 
entity manager are something todo with if it's request or session based 
right? I would actually have thought the error to show the other way around.


Heres some code of my forms, I use  the compoundpropertymodel:

   add(new TextField(lifts).add(NumberValidator.POSITIVE));
   add(new TextField(weight).add(NumberValidator.POSITIVE));

Button btnUpdate = new Button(updateRep, new Model(updateRep)) {
@Override
public void onSubmit() {
//make a roundtrip so JPA saves the changes
}
};

And web.xml:

context-param
param-namecontextConfigLocation/param-name
param-valueclasspath:zeuzContext.xml/param-value
/context-param


filter
filter-nameopenEntityManagerInViewFilter/filter-name
filter-class

org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter
/filter-class
/filter


filter-mapping
filter-nameopenEntityManagerInViewFilter/filter-name
url-pattern/*/url-pattern
/filter-mapping

listener
listener-class
org.springframework.web.context.ContextLoaderListener
/listener-class
/listener
filter
filter-namezeuzGroupApplication/filter-name
filter-class
org.apache.wicket.protocol.http.WicketFilter
/filter-class
init-param
param-nameapplicationClassName/param-name
param-value
zeuzgroup.application.ZeuzGroupApplication
/param-value
/init-param
/filter

filter-mapping
filter-namezeuzGroupApplication/filter-name
url-pattern/zeuz/*/url-pattern
/filter-mapping



--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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



Re: Wicket and JPA(EntityManager PersistenceContextType)?

2008-04-02 Thread Meindert Deen
my 2 cents, don't know if this is your problem:
The transaction based entity manager only commits if the update of the data
is within a transaction.  So you must wrap your  update in a transaction
(you said you used Spring, so you can configure this in your Spring xml or
use the annotation based transactions.)

Hope this helps,

Meindert

On Wed, Apr 2, 2008 at 12:33 PM, Nino Saturnino Martinez Vazquez Wael 
[EMAIL PROTECTED] wrote:

 I know this is not completely related. But here goes anyway.

 I have an application with several different flows. If I switch from
 extended to transaction, suddenly the values in my form aren't save to the
 database(but they are saved in memory), I use spring to instantiate
 entitymanager and inject. It's very strange that it does not work.

 I believe that the difference between expanded and transaction based
 entity manager are something todo with if it's request or session based
 right? I would actually have thought the error to show the other way around.

 Heres some code of my forms, I use  the compoundpropertymodel:

   add(new TextField(lifts).add(NumberValidator.POSITIVE));
   add(new TextField(weight).add(NumberValidator.POSITIVE));

 Button btnUpdate = new Button(updateRep, new Model(updateRep)) {
@Override
 public void onSubmit() {
 //make a roundtrip so JPA saves the changes
}
};

 And web.xml:

context-param
param-namecontextConfigLocation/param-name
param-valueclasspath:zeuzContext.xml/param-value
/context-param


filter
filter-nameopenEntityManagerInViewFilter/filter-name
filter-class

  org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter
/filter-class
/filter


filter-mapping
filter-nameopenEntityManagerInViewFilter/filter-name
url-pattern/*/url-pattern
/filter-mapping

listener
listener-class

  org.springframework.web.context.ContextLoaderListener
/listener-class
/listener
filter
filter-namezeuzGroupApplication/filter-name
filter-class
org.apache.wicket.protocol.http.WicketFilter
/filter-class
init-param
param-nameapplicationClassName/param-name
param-value
zeuzgroup.application.ZeuzGroupApplication
/param-value
/init-param
/filter

filter-mapping
filter-namezeuzGroupApplication/filter-name
url-pattern/zeuz/*/url-pattern
/filter-mapping



 --
 -Wicket for love

 Nino Martinez Wael
 Java Specialist @ Jayway DK
 http://www.jayway.dk
 +45 2936 7684


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




Re: Wicket and JPA(EntityManager PersistenceContextType)?

2008-04-02 Thread Nino Saturnino Martinez Vazquez Wael

Any help apreciated...:)

These lines should take care of transaction wrapping right?:

From my spring xml:

   bean id=txManager
   class=org.springframework.orm.jpa.JpaTransactionManager
   property name=entityManagerFactory
   ref=entityManagerFactory /
   /bean
   tx:annotation-driven transaction-manager=txManager /

And in my dao class:

@Transactional
public class DBDaoImpl implements IDBDao, InitializingBean {
.. Methods..

}

Or should I annotate each method in the class also?



Meindert Deen wrote:

my 2 cents, don't know if this is your problem:
The transaction based entity manager only commits if the update of the data
is within a transaction.  So you must wrap your  update in a transaction
(you said you used Spring, so you can configure this in your Spring xml or
use the annotation based transactions.)

  
Hope this helps,


Meindert

On Wed, Apr 2, 2008 at 12:33 PM, Nino Saturnino Martinez Vazquez Wael 
[EMAIL PROTECTED] wrote:

  

I know this is not completely related. But here goes anyway.

I have an application with several different flows. If I switch from
extended to transaction, suddenly the values in my form aren't save to the
database(but they are saved in memory), I use spring to instantiate
entitymanager and inject. It's very strange that it does not work.

I believe that the difference between expanded and transaction based
entity manager are something todo with if it's request or session based
right? I would actually have thought the error to show the other way around.

Heres some code of my forms, I use  the compoundpropertymodel:

  add(new TextField(lifts).add(NumberValidator.POSITIVE));
  add(new TextField(weight).add(NumberValidator.POSITIVE));

Button btnUpdate = new Button(updateRep, new Model(updateRep)) {
   @Override
public void onSubmit() {
//make a roundtrip so JPA saves the changes
   }
   };

And web.xml:

   context-param
   param-namecontextConfigLocation/param-name
   param-valueclasspath:zeuzContext.xml/param-value
   /context-param


   filter
   filter-nameopenEntityManagerInViewFilter/filter-name
   filter-class

 org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter
   /filter-class
   /filter


   filter-mapping
   filter-nameopenEntityManagerInViewFilter/filter-name
   url-pattern/*/url-pattern
   /filter-mapping

   listener
   listener-class

 org.springframework.web.context.ContextLoaderListener
   /listener-class
   /listener
   filter
   filter-namezeuzGroupApplication/filter-name
   filter-class
   org.apache.wicket.protocol.http.WicketFilter
   /filter-class
   init-param
   param-nameapplicationClassName/param-name
   param-value
   zeuzgroup.application.ZeuzGroupApplication
   /param-value
   /init-param
   /filter

   filter-mapping
   filter-namezeuzGroupApplication/filter-name
   url-pattern/zeuz/*/url-pattern
   /filter-mapping



--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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





  


--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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



Re: Wicket and JPA(EntityManager PersistenceContextType)?

2008-04-02 Thread Nino Saturnino Martinez Vazquez Wael
Hmm thinking over this again. I thought that after you persisted 
something, JPA would handle it for you. So what you are saying are that 
if I get a object from the persistance manager, and then update 
something directly on the POJO i would then have to begin a transaction 
and commit it?


So just binding using a compoundmodel I would have to have a tx begin 
and commit in the submit method of the form?


Like this:

public void onSubmit() {
tx.begin;
tx.commit?
  }
  };



Meindert Deen wrote:

my 2 cents, don't know if this is your problem:
The transaction based entity manager only commits if the update of the data
is within a transaction.  So you must wrap your  update in a transaction
(you said you used Spring, so you can configure this in your Spring xml or
use the annotation based transactions.)

Hope this helps,

Meindert

On Wed, Apr 2, 2008 at 12:33 PM, Nino Saturnino Martinez Vazquez Wael 
[EMAIL PROTECTED] wrote:

  

I know this is not completely related. But here goes anyway.

I have an application with several different flows. If I switch from
extended to transaction, suddenly the values in my form aren't save to the
database(but they are saved in memory), I use spring to instantiate
entitymanager and inject. It's very strange that it does not work.

I believe that the difference between expanded and transaction based
entity manager are something todo with if it's request or session based
right? I would actually have thought the error to show the other way around.

Heres some code of my forms, I use  the compoundpropertymodel:

  add(new TextField(lifts).add(NumberValidator.POSITIVE));
  add(new TextField(weight).add(NumberValidator.POSITIVE));

Button btnUpdate = new Button(updateRep, new Model(updateRep)) {
   @Override
public void onSubmit() {
//make a roundtrip so JPA saves the changes
   }
   };

And web.xml:

   context-param
   param-namecontextConfigLocation/param-name
   param-valueclasspath:zeuzContext.xml/param-value
   /context-param


   filter
   filter-nameopenEntityManagerInViewFilter/filter-name
   filter-class

 org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter
   /filter-class
   /filter


   filter-mapping
   filter-nameopenEntityManagerInViewFilter/filter-name
   url-pattern/*/url-pattern
   /filter-mapping

   listener
   listener-class

 org.springframework.web.context.ContextLoaderListener
   /listener-class
   /listener
   filter
   filter-namezeuzGroupApplication/filter-name
   filter-class
   org.apache.wicket.protocol.http.WicketFilter
   /filter-class
   init-param
   param-nameapplicationClassName/param-name
   param-value
   zeuzgroup.application.ZeuzGroupApplication
   /param-value
   /init-param
   /filter

   filter-mapping
   filter-namezeuzGroupApplication/filter-name
   url-pattern/zeuz/*/url-pattern
   /filter-mapping



--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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





  


--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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



Re: Wicket and JPA(EntityManager PersistenceContextType)?

2008-04-02 Thread Meindert Deen
As I understand it, then your second email is correct. If you don't run the
getting and updating of your components in a transaction, your Entity gets
decoupled (JPA default behavior is to decouple the Entities outside of a
transaction), so it will not save any updates done outside of the
transaction.

On Wed, Apr 2, 2008 at 2:38 PM, Nino Saturnino Martinez Vazquez Wael 
[EMAIL PROTECTED] wrote:

 Hmm thinking over this again. I thought that after you persisted
 something, JPA would handle it for you. So what you are saying are that if I
 get a object from the persistance manager, and then update something
 directly on the POJO i would then have to begin a transaction and commit it?

 So just binding using a compoundmodel I would have to have a tx begin and
 commit in the submit method of the form?

 Like this:

 public void onSubmit() {
 tx.begin;
 tx.commit?
  }
  };




 Meindert Deen wrote:

  my 2 cents, don't know if this is your problem:
  The transaction based entity manager only commits if the update of the
  data
  is within a transaction.  So you must wrap your  update in a transaction
  (you said you used Spring, so you can configure this in your Spring xml
  or
  use the annotation based transactions.)
 
  Hope this helps,
 
  Meindert
 
  On Wed, Apr 2, 2008 at 12:33 PM, Nino Saturnino Martinez Vazquez Wael 
  [EMAIL PROTECTED] wrote:
 
 
 
   I know this is not completely related. But here goes anyway.
  
   I have an application with several different flows. If I switch from
   extended to transaction, suddenly the values in my form aren't save to
   the
   database(but they are saved in memory), I use spring to instantiate
   entitymanager and inject. It's very strange that it does not work.
  
   I believe that the difference between expanded and transaction based
   entity manager are something todo with if it's request or session
   based
   right? I would actually have thought the error to show the other way
   around.
  
   Heres some code of my forms, I use  the compoundpropertymodel:
  
add(new TextField(lifts).add(NumberValidator.POSITIVE));
add(new TextField(weight).add(NumberValidator.POSITIVE));
  
   Button btnUpdate = new Button(updateRep, new Model(updateRep)) {
 @Override
   public void onSubmit() {
   //make a roundtrip so JPA saves the changes
 }
 };
  
   And web.xml:
  
 context-param
 param-namecontextConfigLocation/param-name
 param-valueclasspath:zeuzContext.xml/param-value
 /context-param
  
  
 filter
 filter-nameopenEntityManagerInViewFilter/filter-name
 filter-class
  
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter
 /filter-class
 /filter
  
  
 filter-mapping
 filter-nameopenEntityManagerInViewFilter/filter-name
 url-pattern/*/url-pattern
 /filter-mapping
  
 listener
 listener-class
  
org.springframework.web.context.ContextLoaderListener
 /listener-class
 /listener
 filter
 filter-namezeuzGroupApplication/filter-name
 filter-class
 org.apache.wicket.protocol.http.WicketFilter
 /filter-class
 init-param
 param-nameapplicationClassName/param-name
 param-value
  
   zeuzgroup.application.ZeuzGroupApplication
 /param-value
 /init-param
 /filter
  
 filter-mapping
 filter-namezeuzGroupApplication/filter-name
 url-pattern/zeuz/*/url-pattern
 /filter-mapping
  
  
  
   --
   -Wicket for love
  
   Nino Martinez Wael
   Java Specialist @ Jayway DK
   http://www.jayway.dk
   +45 2936 7684
  
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
  
 
 
 

 --
 -Wicket for love

 Nino Martinez Wael
 Java Specialist @ Jayway DK
 http://www.jayway.dk
 +45 2936 7684


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




Re: Wicket and JPA(EntityManager PersistenceContextType)?

2008-04-02 Thread Meindert Deen
FYI: Reference blog post:
http://weblogs.java.net/blog/davidvc/archive/2007/04/jpa_and_rollbac.html

On Wed, Apr 2, 2008 at 3:55 PM, Meindert Deen [EMAIL PROTECTED] wrote:

 As I understand it, then your second email is correct. If you don't run
 the getting and updating of your components in a transaction, your Entity
 gets decoupled (JPA default behavior is to decouple the Entities outside of
 a transaction), so it will not save any updates done outside of the
 transaction.


 On Wed, Apr 2, 2008 at 2:38 PM, Nino Saturnino Martinez Vazquez Wael 
 [EMAIL PROTECTED] wrote:

  Hmm thinking over this again. I thought that after you persisted
  something, JPA would handle it for you. So what you are saying are that if I
  get a object from the persistance manager, and then update something
  directly on the POJO i would then have to begin a transaction and commit it?
 
  So just binding using a compoundmodel I would have to have a tx begin
  and commit in the submit method of the form?
 
  Like this:
 
  public void onSubmit() {
  tx.begin;
  tx.commit?
   }
   };
 
 
 
 
  Meindert Deen wrote:
 
   my 2 cents, don't know if this is your problem:
   The transaction based entity manager only commits if the update of the
   data
   is within a transaction.  So you must wrap your  update in a
   transaction
   (you said you used Spring, so you can configure this in your Spring
   xml or
   use the annotation based transactions.)
  
   Hope this helps,
  
   Meindert
  
   On Wed, Apr 2, 2008 at 12:33 PM, Nino Saturnino Martinez Vazquez Wael
   
   [EMAIL PROTECTED] wrote:
  
  
  
I know this is not completely related. But here goes anyway.
   
I have an application with several different flows. If I switch from
extended to transaction, suddenly the values in my form aren't save
to the
database(but they are saved in memory), I use spring to instantiate
entitymanager and inject. It's very strange that it does not work.
   
I believe that the difference between expanded and transaction based
entity manager are something todo with if it's request or session
based
right? I would actually have thought the error to show the other way
around.
   
Heres some code of my forms, I use  the compoundpropertymodel:
   
 add(new TextField(lifts).add(NumberValidator.POSITIVE));
 add(new TextField(weight).add(NumberValidator.POSITIVE));
   
Button btnUpdate = new Button(updateRep, new Model(updateRep)) {
  @Override
public void onSubmit() {
//make a roundtrip so JPA saves the changes
  }
  };
   
And web.xml:
   
  context-param
  param-namecontextConfigLocation/param-name
  param-valueclasspath:zeuzContext.xml/param-value
  /context-param
   
   
  filter
   
filter-nameopenEntityManagerInViewFilter/filter-name
  filter-class
   
 org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter
  /filter-class
  /filter
   
   
  filter-mapping
   
filter-nameopenEntityManagerInViewFilter/filter-name
  url-pattern/*/url-pattern
  /filter-mapping
   
  listener
  listener-class
   
 org.springframework.web.context.ContextLoaderListener
  /listener-class
  /listener
  filter
  filter-namezeuzGroupApplication/filter-name
  filter-class
  org.apache.wicket.protocol.http.WicketFilter
  /filter-class
  init-param
  param-nameapplicationClassName/param-name
  param-value
   
zeuzgroup.application.ZeuzGroupApplication
  /param-value
  /init-param
  /filter
   
  filter-mapping
  filter-namezeuzGroupApplication/filter-name
  url-pattern/zeuz/*/url-pattern
  /filter-mapping
   
   
   
--
-Wicket for love
   
Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684
   
   
   
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
   
   
   
   
  
  
  
 
  --
  -Wicket for love
 
  Nino Martinez Wael
  Java Specialist @ Jayway DK
  http://www.jayway.dk
  +45 2936 7684
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 



Re: Wicket and JPA(EntityManager PersistenceContextType)?

2008-04-02 Thread Nino Saturnino Martinez Vazquez Wael

thanks..

I think i'll continue on OpenJPA user forum

Meindert Deen wrote:

FYI: Reference blog post:
http://weblogs.java.net/blog/davidvc/archive/2007/04/jpa_and_rollbac.html

On Wed, Apr 2, 2008 at 3:55 PM, Meindert Deen [EMAIL PROTECTED] wrote:

  

As I understand it, then your second email is correct. If you don't run
the getting and updating of your components in a transaction, your Entity
gets decoupled (JPA default behavior is to decouple the Entities outside of
a transaction), so it will not save any updates done outside of the
transaction.


On Wed, Apr 2, 2008 at 2:38 PM, Nino Saturnino Martinez Vazquez Wael 
[EMAIL PROTECTED] wrote:



Hmm thinking over this again. I thought that after you persisted
something, JPA would handle it for you. So what you are saying are that if I
get a object from the persistance manager, and then update something
directly on the POJO i would then have to begin a transaction and commit it?

So just binding using a compoundmodel I would have to have a tx begin
and commit in the submit method of the form?

Like this:

public void onSubmit() {
tx.begin;
tx.commit?
 }
 };




Meindert Deen wrote:

  

my 2 cents, don't know if this is your problem:
The transaction based entity manager only commits if the update of the
data
is within a transaction.  So you must wrap your  update in a
transaction
(you said you used Spring, so you can configure this in your Spring
xml or
use the annotation based transactions.)

Hope this helps,

Meindert

On Wed, Apr 2, 2008 at 12:33 PM, Nino Saturnino Martinez Vazquez Wael

[EMAIL PROTECTED] wrote:





I know this is not completely related. But here goes anyway.

I have an application with several different flows. If I switch from
extended to transaction, suddenly the values in my form aren't save
to the
database(but they are saved in memory), I use spring to instantiate
entitymanager and inject. It's very strange that it does not work.

I believe that the difference between expanded and transaction based
entity manager are something todo with if it's request or session
based
right? I would actually have thought the error to show the other way
around.

Heres some code of my forms, I use  the compoundpropertymodel:

 add(new TextField(lifts).add(NumberValidator.POSITIVE));
 add(new TextField(weight).add(NumberValidator.POSITIVE));

Button btnUpdate = new Button(updateRep, new Model(updateRep)) {
  @Override
public void onSubmit() {
//make a roundtrip so JPA saves the changes
  }
  };

And web.xml:

  context-param
  param-namecontextConfigLocation/param-name
  param-valueclasspath:zeuzContext.xml/param-value
  /context-param


  filter

filter-nameopenEntityManagerInViewFilter/filter-name
  filter-class

 org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter
  /filter-class
  /filter


  filter-mapping

filter-nameopenEntityManagerInViewFilter/filter-name
  url-pattern/*/url-pattern
  /filter-mapping

  listener
  listener-class

 org.springframework.web.context.ContextLoaderListener
  /listener-class
  /listener
  filter
  filter-namezeuzGroupApplication/filter-name
  filter-class
  org.apache.wicket.protocol.http.WicketFilter
  /filter-class
  init-param
  param-nameapplicationClassName/param-name
  param-value

zeuzgroup.application.ZeuzGroupApplication
  /param-value
  /init-param
  /filter

  filter-mapping
  filter-namezeuzGroupApplication/filter-name
  url-pattern/zeuz/*/url-pattern
  /filter-mapping



--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684



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




  




--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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


  


  


--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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