Hi there,
See other replies in this thread. I can only add that Cayenne is as mature as
Hibernate, and has its own approaches to a set of persistence problems (so if
you are looking for 1..1 correspondence, there won't be one). Cayenne most
certainly can be and has been integrated with all kinds of frontend and IoC(DI)
technologies, batch job processors, web services, etc.
Usually it doesn't require a separate framework to do that :-) E.g. here is a
typical "CayenneService" that I am mapping in a DI container of my app (based
on 3.1 code) to provide the rest of the app with access to Cayenne. Showing it
here in full as another 3.1 primer. As you see it is pretty thin:
public interface ICayenneService {
void addListener(Object listener);
void addFilter(DataChannelFilter filter);
ObjectContext sharedContext();
ObjectContext newContext();
}
public class CayenneService implements ICayenneService {
private ObjectContext sharedContext;
private ServerRuntime runtime;
public CayenneService() {
Module module = new Module() {
@Override
public void configure(Binder binder) {
// customize Cayenne internals here...
binder.bind(QueryCache.class).toInstance(new
OSQueryCache());
}
};
// bootstrap one or more mappings, creating Runtime object...
runtime = new ServerRuntime("cayenne-site.xml", ocModule);
// start a read-only shared context
sharedContext = runtime.getContext();
}
@Override
public void addListener(Object listener) {
runtime.getDataDomain().getEntityResolver().getCallbackRegistry()
.addListener(listener);
}
@Override
public void addFilter(DataChannelFilter filter) {
runtime.getDataDomain().addFilter(filter);
addListener(filter);
}
@Override
public ObjectContext sharedContext() {
return sharedContext;
}
@Override
public ObjectContext newContext() {
return runtime.getContext();
}
}
Andrus
On Sep 11, 2011, at 5:41 PM, stéphane Lestoclet wrote:
> Hi,
>
>
> The Cayenne documentation states the following :
>
> Chapter: Understanding Transactions
>> It works either as a standalone mechanism, or in conjunction with another
>> transaction framework, such as JTA or Spring..
>
> Could you provide examples for both please ?
>
> Actually, I am new to Apache Cayenne and I am trying to find a serious
> alternative to Hibernate.
> Unfortunately, Spring does not provide a CayenneTransactionManager as for
> Hibernate, iBatis and JPA. This makes it difficult to show that
> Cayenne integrates well with the famous integration framework which is Spring.
>
> It would also be a very good idea to ship examples with Cayenne (JUnit Tests
> would be great) in order to show that Cayenne
> can be actually used/integrated with other technologies.
>
> Thanks in advance,