Re: Ajaxbutton, updating forms, broken persistence: strange, seemingly unrelated behaviour

2012-06-20 Thread lucast
Thank you, Sven.

In my code I was not calling LoadableDetachableModel.detach() after
persisting objects to the database. Something I should have done.

As for the new events mechanism, I just had a look at the Migration to
Wicket 1.5 and it looks like it's just what I need. The example from the
wicket-example page is clear and concise. This will indeed "untangle" my
code as you rightly put it.

I shall read the Migration to Wicket 1.5 document as up until now I was more
concern of having my code up and running and charging ahead with having my
1.4 code working on 1.5.

Thanks for your help,
Lucas

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Ajaxbutton-updating-forms-broken-persistence-strange-seemingly-unrelated-behaviour-tp4650049p4650112.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: Ajaxbutton, updating forms, broken persistence: strange, seemingly unrelated behaviour

2012-06-19 Thread Sven Meier

Hi,

without code its difficult to say what's going wrong in your project.

wicket-dnd uses normal Wicke ajax request, so you can do anything what 
you would do with any other ajax enabled component: change models and 
components.


>The way I did this is I passed the parent tabbed panel wrapped in an Model
>all the way down to the wicketDnD table cells and from there I unwrap the
>parent tabbed panel and call parentTabbedPanel.makeButtonVisible(),
>passing the AjaxRequestTarget object from the wicketDnD object.

This sounds a little bit complicated, perhaps using the new event 
mechanism would help to untangled this?


>Now, even calling LoadableDetachableModel.getObject() will not return 
updated objects from the DB.


Usually you'll have to call detach() on you LDM if you change something 
in the DB, e.g. add or remove a record. Are you doing this?


Hope this helps
Sven


On 06/19/2012 10:57 AM, lucast wrote:

Dear Forum,
I apologise for this long post.

1) I have a long nested structure of panels: a tabbed panel containing the
main panel, which holds a dynamically created table and each table cell has
a small panel with wicketDnD functionality.

2) I wanted the tabbed to have a small panel with labels and have an ajax
button made visible whenever something is dropped on the wicketDnD table
cells.

3) Within the wicketDnD table cells onDrop(AjaxRequestTarget target,
Transfer transfer, Location location) and onAfterDrop(AjaxRequestTarget
target, Transfer transfer) I persist objects to the database using standard
hibernate calls.

4)This worked fine until I implemented the functionality described in 2).
The way I did this is I passed the parent tabbed panel wrapped in an Model
all the way down to the wicketDnD table cells and from there I unwrap the
parent tabbed panel and call parentTabbedPanel.makeButtonVisible(), passing
the AjaxRequestTarget object from the wicketDnD object.

Now, even calling LoadableDetachableModel.getObject() will not return
updated objects from the DB.

This, strangely enough, only happens the third time I make use of
wicketDnD.onDrop() or wicketDnD.onAfterDrop().
I am loosing the hibernate session. But this didn't happen before I
implemented 2) (described above).

So:
I don't know if the way I implemented 4) is the right way to implement such
functionality
And
How could this Ajax behaviour have broken the hibernate session?

I am utterly baffled.
Thanks in advance,
Lucas



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Ajaxbutton-updating-forms-broken-persistence-strange-seemingly-unrelated-behaviour-tp4650049.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