Yeah, even though there are this disadvantages, it is a really good
idea to use detachable models when you work with Hibernate. Or unproxy
your objects before you keep them as state.
In fact, the example that you gave would be fine, as you are not
holding the actual hibernate object, but just get a few strings out of
it. As long as you don't keep references to your Hibernate objects
(either by putting them in models, or keeping them as properties of
your components), you'll be fine.
Eelco
On 2/10/06, VGJ <[EMAIL PROTECTED]> wrote:
> Ugh...not sure I like that solution...you described exactly why too.
>
> I'm using Hibernate and I'm opening my sessions in my DAO layer and closing
> them w/ a Filter...will this still affect me (i.e. stale sessions)?? I just
> started using Wicket yesterday so I'm a poppin-fresh newbie.
>
> On 2/10/06, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> >
> > Yep, that's it. Instead of passing your domain object directly, you
> > might consider putting it behind a IModel instance:
> >
> > public class HeaderPanel extends Panel
> > {
> > public HeaderPanel(String id, IModel blog)
> > {
> > super(id);
> >
> > add(new Label("name", new PropertyModel(blog, "name"));
> > add(new Label("synopsis", new PropertyModel(blog,
> "synopsis"));
> > }
> > }
> >
> > or
> >
> > public class HeaderPanel extends Panel
> > {
> > public HeaderPanel(String id, IModel blog)
> > {
> > super(id, new CompoundPropertyModel(blog));
> >
> > add(new Label("name"));
> > add(new Label("synopsis"));
> > }
> > }
> >
> > Pro for using IModel instead of domain object: you can later decide to
> > use detachable models, which is usually a good idea when you use
> > Hibernate (otherwise you'll end up with stale Session references in
> > your objects) and which will use less session memory.
> >
> > Con: it's more work, makes the code harder to follow, you have to do
> > refactorings of properties by hand and less efficient if memory is not
> > a problem.
> >
> > Oooh, I whish we could use generics for the core project so that the
> > first few cons were eliminated.
> >
> > Eelco
> >
> >
> > On 2/10/06, V. Jenks <[EMAIL PROTECTED] > wrote:
> > > I'm having a little trouble understanding how to use Panels correctly.
> > >
> > > I'm trying to convert a JSP that has many JSP 2.0 tagfile "includes" of
> > > which I pass objects into so they can display some of the data that the
> > > "master" JSP tag displays.
> > >
> > > In Wicket, I've re-created the tagfiles as Panels and I'm trying to pass
> > > data to them from the "master" page class through the Panels'
> > > constructors..like so:
> > >
> > > public class HeaderPanel extends Panel
> > > {
> > > public HeaderPanel(String id, Blog blog)
> > > {
> > > super(id);
> > >
> > > add(new Label("name", blog.getName()));
> > > add(new Label("synopsis", blog.getSynopsis()));
> > > }
> > > }
> > >
> > > I'm guessing that this is the way to do this as I haven't been able to
> > > find any examples stating otherwise.
> > >
> > > Am I on the right track? Maybe the wiki could use a JSP-to-Wicket
> > > upgrade path type of document?
> > >
> > > Thanks!
> > >
> > >
> > >
> > > -------------------------------------------------------
> > > This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> files
> > > for problems? Stop! Download the new AJAX search engine that makes
> > > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> > >
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
> > > _______________________________________________
> > > Wicket-user mailing list
> > > [email protected]
> > >
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> > >
> >
> >
> > -------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> files
> > for problems? Stop! Download the new AJAX search engine that makes
> > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> >
> http://sel.as-us.falkag.net/sel?cmdlnk&kid3432&bid#0486&dat1642
> > _______________________________________________
> > Wicket-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
>
>
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user