Re: Managing database connection?

2008-08-03 Thread Martijn Dashorst
Most folks use open session in view filter from Spring (in combination
with Hibernate). I think they have a similar filter for JDBC template
(which is highly recommended for normal JDBC actions IMO).

Martijn

On Sun, Aug 3, 2008 at 12:45 PM, Martin Makundi
[EMAIL PROTECTED] wrote:
 Hi!

 What is the best place to open/close a data connection in Wicket?

 I prefer lazy open, but where is the best place to perform the
 connection/entitymanager.close? Override servlet request? Filter?

 **
 Martin

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





-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.4 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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



Managing database connection?

2008-08-03 Thread Martin Makundi
Hi!

What is the best place to open/close a data connection in Wicket?

I prefer lazy open, but where is the best place to perform the
connection/entitymanager.close? Override servlet request? Filter?

**
Martin

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



Problem on external LoadableDetachableModel class

2008-08-03 Thread alex2008


  @SpringBean
private ProductManager productManager;
//@Autowired
public void setProductManager(ProductManager productManager) {
this.productManager = productManager;
}
.
 LoadableDetachableModel personListModel = new LoadableDetachableModel() {
@Override
protected Object load() {
return productManager.getProducts();
}
};
add(new ListView(products, personListModel) {

});
It's ok. 


While if a use an external class:
package wicketapp.util;

import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
import springapp.service.ProductManager;

public class ProductModel extends LoadableDetachableModel {
@SpringBean
private ProductManager productManager;
//@Autowired
public void setProductManager(ProductManager productManager) {
this.productManager = productManager;
}

protected Object load() {
return productManager.getProducts();
}
}

..
 ProductModel personListModel = new ProductModel();

add(new ListView(products, personListModel) {
...
});

It's wrong. 

Which is the problem?
-- 
View this message in context: 
http://www.nabble.com/Problem-on-external-LoadableDetachableModel-class-tp18797009p18797009.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: Managing database connection?

2008-08-03 Thread Martin Makundi
I am using Hibernate/JPA without Spring. Is there a suitable
interceptor class in Wicket that could be used?

**
Martin

2008/8/3 Martijn Dashorst [EMAIL PROTECTED]:
 Most folks use open session in view filter from Spring (in combination
 with Hibernate). I think they have a similar filter for JDBC template
 (which is highly recommended for normal JDBC actions IMO).

 Martijn

 On Sun, Aug 3, 2008 at 12:45 PM, Martin Makundi
 [EMAIL PROTECTED] wrote:
 Hi!

 What is the best place to open/close a data connection in Wicket?

 I prefer lazy open, but where is the best place to perform the
 connection/entitymanager.close? Override servlet request? Filter?

 **
 Martin

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





 --
 Become a Wicket expert, learn from the best: http://wicketinaction.com
 Apache Wicket 1.3.4 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

 -
 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: Problem on external LoadableDetachableModel class

2008-08-03 Thread Martijn Dashorst
http://cwiki.apache.org/WICKET/[EMAIL PROTECTED]

On Sun, Aug 3, 2008 at 11:07 AM, alex2008 [EMAIL PROTECTED] wrote:

 
  @SpringBean
private ProductManager productManager;
//@Autowired
public void setProductManager(ProductManager productManager) {
this.productManager = productManager;
}
 .
  LoadableDetachableModel personListModel = new LoadableDetachableModel() {
@Override
protected Object load() {
return productManager.getProducts();
}
};
 add(new ListView(products, personListModel) {
 
});
 It's ok.


 While if a use an external class:
 package wicketapp.util;

 import org.apache.wicket.model.LoadableDetachableModel;
 import org.apache.wicket.spring.injection.annot.SpringBean;
 import springapp.service.ProductManager;

 public class ProductModel extends LoadableDetachableModel {
@SpringBean
private ProductManager productManager;
//@Autowired
public void setProductManager(ProductManager productManager) {
this.productManager = productManager;
}

protected Object load() {
return productManager.getProducts();
}
 }

 ..
  ProductModel personListModel = new ProductModel();

add(new ListView(products, personListModel) {
...
});

 It's wrong.

 Which is the problem?
 --
 View this message in context: 
 http://www.nabble.com/Problem-on-external-LoadableDetachableModel-class-tp18797009p18797009.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]





-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.4 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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



Re: Managing database connection?

2008-08-03 Thread Martijn Dashorst
Create a custom request cycle that opens a Session in onBeginRequest
and closes it in onEndRequest. Perhaps DataBinder.net has one readily
available.

Martijn

On Sun, Aug 3, 2008 at 1:11 PM, Martin Makundi
[EMAIL PROTECTED] wrote:
 I am using Hibernate/JPA without Spring. Is there a suitable
 interceptor class in Wicket that could be used?

 **
 Martin

 2008/8/3 Martijn Dashorst [EMAIL PROTECTED]:
 Most folks use open session in view filter from Spring (in combination
 with Hibernate). I think they have a similar filter for JDBC template
 (which is highly recommended for normal JDBC actions IMO).

 Martijn

 On Sun, Aug 3, 2008 at 12:45 PM, Martin Makundi
 [EMAIL PROTECTED] wrote:
 Hi!

 What is the best place to open/close a data connection in Wicket?

 I prefer lazy open, but where is the best place to perform the
 connection/entitymanager.close? Override servlet request? Filter?

 **
 Martin

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





 --
 Become a Wicket expert, learn from the best: http://wicketinaction.com
 Apache Wicket 1.3.4 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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





-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.4 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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



Re: Managing database connection?

2008-08-03 Thread Martin Makundi
Anything lighter? Basically I just need to hook the onEndRequest()
event. I assume it would be bad practice to extend the wicket servlet,
though ..

**
Martin

2008/8/3 Martijn Dashorst [EMAIL PROTECTED]:
 Create a custom request cycle that opens a Session in onBeginRequest
 and closes it in onEndRequest. Perhaps DataBinder.net has one readily
 available.

 Martijn

 On Sun, Aug 3, 2008 at 1:11 PM, Martin Makundi
 [EMAIL PROTECTED] wrote:
 I am using Hibernate/JPA without Spring. Is there a suitable
 interceptor class in Wicket that could be used?

 **
 Martin

 2008/8/3 Martijn Dashorst [EMAIL PROTECTED]:
 Most folks use open session in view filter from Spring (in combination
 with Hibernate). I think they have a similar filter for JDBC template
 (which is highly recommended for normal JDBC actions IMO).

 Martijn

 On Sun, Aug 3, 2008 at 12:45 PM, Martin Makundi
 [EMAIL PROTECTED] wrote:
 Hi!

 What is the best place to open/close a data connection in Wicket?

 I prefer lazy open, but where is the best place to perform the
 connection/entitymanager.close? Override servlet request? Filter?

 **
 Martin

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





 --
 Become a Wicket expert, learn from the best: http://wicketinaction.com
 Apache Wicket 1.3.4 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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





 --
 Become a Wicket expert, learn from the best: http://wicketinaction.com
 Apache Wicket 1.3.4 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

 -
 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: Managing database connection?

2008-08-03 Thread Martijn Dashorst
how is a custom request cycle heavy weight? It isn't–it's a common practise.

Martijn

On Sun, Aug 3, 2008 at 2:28 PM, Martin Makundi
[EMAIL PROTECTED] wrote:
 Anything lighter? Basically I just need to hook the onEndRequest()
 event. I assume it would be bad practice to extend the wicket servlet,
 though ..

 **
 Martin

 2008/8/3 Martijn Dashorst [EMAIL PROTECTED]:
 Create a custom request cycle that opens a Session in onBeginRequest
 and closes it in onEndRequest. Perhaps DataBinder.net has one readily
 available.

 Martijn

 On Sun, Aug 3, 2008 at 1:11 PM, Martin Makundi
 [EMAIL PROTECTED] wrote:
 I am using Hibernate/JPA without Spring. Is there a suitable
 interceptor class in Wicket that could be used?

 **
 Martin

 2008/8/3 Martijn Dashorst [EMAIL PROTECTED]:
 Most folks use open session in view filter from Spring (in combination
 with Hibernate). I think they have a similar filter for JDBC template
 (which is highly recommended for normal JDBC actions IMO).

 Martijn

 On Sun, Aug 3, 2008 at 12:45 PM, Martin Makundi
 [EMAIL PROTECTED] wrote:
 Hi!

 What is the best place to open/close a data connection in Wicket?

 I prefer lazy open, but where is the best place to perform the
 connection/entitymanager.close? Override servlet request? Filter?

 **
 Martin

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





 --
 Become a Wicket expert, learn from the best: http://wicketinaction.com
 Apache Wicket 1.3.4 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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





 --
 Become a Wicket expert, learn from the best: http://wicketinaction.com
 Apache Wicket 1.3.4 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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





-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.4 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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



Re: Managing database connection?

2008-08-03 Thread Martin Makundi
 how is a custom request cycle heavy weight? It isn't–it's a common practise.

Ok :) I just had a look at DataBinder.net, that was more heavy-weght.

Is there any short introduction available on how to implement
onEndRequest() -hook, or is the best reference to just have a look at
the respective code of DataBinder.net?

**
Martin

 On Sun, Aug 3, 2008 at 2:28 PM, Martin Makundi
 [EMAIL PROTECTED] wrote:
 Anything lighter? Basically I just need to hook the onEndRequest()
 event. I assume it would be bad practice to extend the wicket servlet,
 though ..

 **
 Martin

 2008/8/3 Martijn Dashorst [EMAIL PROTECTED]:
 Create a custom request cycle that opens a Session in onBeginRequest
 and closes it in onEndRequest. Perhaps DataBinder.net has one readily
 available.

 Martijn

 On Sun, Aug 3, 2008 at 1:11 PM, Martin Makundi
 [EMAIL PROTECTED] wrote:
 I am using Hibernate/JPA without Spring. Is there a suitable
 interceptor class in Wicket that could be used?

 **
 Martin

 2008/8/3 Martijn Dashorst [EMAIL PROTECTED]:
 Most folks use open session in view filter from Spring (in combination
 with Hibernate). I think they have a similar filter for JDBC template
 (which is highly recommended for normal JDBC actions IMO).

 Martijn

 On Sun, Aug 3, 2008 at 12:45 PM, Martin Makundi
 [EMAIL PROTECTED] wrote:
 Hi!

 What is the best place to open/close a data connection in Wicket?

 I prefer lazy open, but where is the best place to perform the
 connection/entitymanager.close? Override servlet request? Filter?

 **
 Martin

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





 --
 Become a Wicket expert, learn from the best: http://wicketinaction.com
 Apache Wicket 1.3.4 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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





 --
 Become a Wicket expert, learn from the best: http://wicketinaction.com
 Apache Wicket 1.3.4 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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





 --
 Become a Wicket expert, learn from the best: http://wicketinaction.com
 Apache Wicket 1.3.4 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

 -
 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: Problem on external LoadableDetachableModel class

2008-08-03 Thread alex2008

Thanks for the link.

I read the article but i don't understand how i can resolve the problem.
-- 
View this message in context: 
http://www.nabble.com/Problem-on-external-LoadableDetachableModel-class-tp18797009p18798487.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: Problem on external LoadableDetachableModel class

2008-08-03 Thread Martijn Dashorst
Odd, I thought it would contain instructions on how to inject
non-component classes using:

Add this to the constructor of your non-component class (i.e. your model):

InjectorHolder.getInjector().inject(this);

See also [1]

Martijn

[1] 
http://markmail.org/message/u7lgvd2azwpl3m4a#query:+page:1+mid:xzzx2cz6si36x7bz+state:results

On Sun, Aug 3, 2008 at 3:10 PM, alex2008 [EMAIL PROTECTED] wrote:

 Thanks for the link.

 I read the article but i don't understand how i can resolve the problem.
 --
 View this message in context: 
 http://www.nabble.com/Problem-on-external-LoadableDetachableModel-class-tp18797009p18798487.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]





-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.4 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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



Re: Problem on external LoadableDetachableModel class

2008-08-03 Thread alex2008

Thanks a lot Martin, your help was precious. =)


Martijn Dashorst wrote:
 
 Odd, I thought it would contain instructions on how to inject
 non-component classes using:
 
 Add this to the constructor of your non-component class (i.e. your model):
 
 InjectorHolder.getInjector().inject(this);
 
 See also [1]
 
 Martijn
 
 [1]
 http://markmail.org/message/u7lgvd2azwpl3m4a#query:+page:1+mid:xzzx2cz6si36x7bz+state:results
 
 On Sun, Aug 3, 2008 at 3:10 PM, alex2008 [EMAIL PROTECTED] wrote:

 Thanks for the link.

 I read the article but i don't understand how i can resolve the problem.
 --
 View this message in context:
 http://www.nabble.com/Problem-on-external-LoadableDetachableModel-class-tp18797009p18798487.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]


 
 
 
 -- 
 Become a Wicket expert, learn from the best: http://wicketinaction.com
 Apache Wicket 1.3.4 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Problem-on-external-LoadableDetachableModel-class-tp18797009p18799466.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]



Hook for hiding columns of DataTable?

2008-08-03 Thread Jeremy Thomerson
I've perused the source and can't find an easy way to do this.  I'm hoping
that maybe someone else has done it.

In an app for one customer, I have a table that lists parts that could be
purchased.  It is a subclass of DefaultDataTable.  I pass it in a custom
sortable data provider that wraps a list - so it has all parts in a list.
Then, I have filters above the table that can filter the list to a specific
category of parts.  But if you filter down to a certain category of parts,
some of those columns will be completely empty.  It would be nice to hide
them.  But the table was already created - and it operates off of a static
array of columns.  The column doesn't provide an isVisible mechanism.  Is
there an easy way to hide it, or does the table need to be recreated and
replaced within the ajax link?

The current code is basically like this:

final ListSortableDataProvider dp = new
ListSortableDataProvider(listOfParts, columnToSortOn);
final PartInfoTable table = new PartInfoTable(table, new
VendorColumnFactory(vendor), vendor, dp);
add(table.setOutputMarkupId(true));

AjaxFallbackLink filterLink = new AjaxFallbackLink(link) {
private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
OrderVendorColumn column = (OrderVendorColumn)
nextFilterableColumn.getObject();
String valueToFilterOn = (String) item.getModelObject();
mPartFilter.addFilter(column, valueToFilterOn);
dp.setList(mPartFilter.filterPartsList(parts));
if (target != null) {
target.addComponent(table);
target.addComponent(LookupPartsPage.this.get(currentFilter));
target.addComponent(LookupPartsPage.this.get(addFilter));
}
}
};
filterLink.add(new Label(label, item.getModel()).setRenderBodyOnly(true));


-- 
Jeremy Thomerson
http://www.wickettraining.com


Clear all sessions?

2008-08-03 Thread Ryan McKinley

Hello!

Is there any way to clear all the session/state data for all users ?

I have tried implementing an ISessionStore  
(SecondLevelCacheSessionStore) that hangs on to (wicket) Sessions  
between onBind and onUnbind.  When I want to clear then, I call  
invalidate() on all sessions.


This does not work because invalidate() needs to be called within  
the Request for that Session.


Any ideas?

Thanks
ryan


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



Re: users, please give us your opinion: what is your take on generics with Wicket

2008-08-03 Thread John Patterson

Just started using the half-way approach and I really miss the type safety of
generified Component.

1) Generifying* Wicket 
   [X] Can best be done like currently in the 1.4 branch, where models 
and components are both generified. I care most about the improved 
static type checking generified models and components give Wicket. 

2) How strongly do you feel about your choice above? 
   [X] Whatever choice ultimately made, I'll happily convert/ start 
using 1.4 and up. 



-- 
View this message in context: 
http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p18800407.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]