I've written a project with the plain mongodb java driver. Not too bad IMO. I don't think there's a need to use spring-data-mongodb.
The code is currently closed, but I aim to open up some things in the new year. In the mean time, here's my MongoRequestCycleListener: import org.apache.wicket.request.cycle.AbstractRequestCycleListener; import org.apache.wicket.request.cycle.RequestCycle; import com.mongodb.DB; public class MongoRequestCycleListener extends AbstractRequestCycleListener implements MongoProvider { private static final ThreadLocal<DB> db = new ThreadLocal<DB>(); private final MongoProvider provider; public MongoRequestCycleListener(MongoProvider provider) { this.provider = provider; } @Override public DB getDB() { DB db = MongoRequestCycleListener.db.get(); assert db != null; return db; } @Override public void onBeginRequest(RequestCycle cycle) { DB threadLocalDB = provider.getDB(); threadLocalDB.requestStart(); db.set(threadLocalDB); } @Override public void onEndRequest(RequestCycle cycle) { DB db2 = db.get(); if (db2 != null) { db2.requestDone(); db.remove(); } } } and the MongoProvider interface: import com.mongodb.DB; public interface MongoProvider { public DB getDB(); } Now all you need to do is inject a mongo provider into your services and you can get the DB. For example: public List<User> byName(String name) { DBCollection users = provider.getDB().getCollection("Users"); DBObject result = users.find(new BasicDBObject("name", name)); // ... convert result in list of users. return convertedList; } In onBeginRequest() I start a 'mongo transaction' and in onEndRequest I close that transaction. It is not a transaction in the common SQL world sense, but should suffice. Martijn On Mon, Dec 12, 2011 at 6:18 AM, Jeff Schneller <j...@mootus.com> wrote: > Has anyone implemented wicket with spring and mongodb. I saw there was a > project back in June about scala, wicket, spring, and mongodb but the scala > portion is a bit confusing. > > Looking for a sample implementation/configuration to get going with. > > Thanks. > -- 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