Andrus Adamchik and Eric Schneider present Cayenne - an open source Object Relational Mapping (ORM) framework. Cayenne is an integrated suite that includes modeling and deployment tools. This article introduces some of Cayenne's features, and shows how to quickly create an ORM application.
Read Cayenne: Being Productive with Object Relational Mapping
-
TSS Article: Object Relational Mapping with Cayenne (19 messages)
- Posted by: Nitin Bharti
- Posted on: June 02 2004 12:16 EDT
Threaded Messages (19)
- I like the looks of this. by Joseph Ottinger on June 02 2004 14:00 EDT
- distributed cache by Perrin Harkins on June 02 2004 16:53 EDT
- distributed cache by Andrus Adamchik on June 02 2004 05:18 EDT
- I like the looks of this. by Andrus Adamchik on June 02 2004 17:26 EDT
- Cayenne vs. Hibernate by j w on June 03 2004 04:50 EDT
-
Cayenne and session replication by Raffaele Guidi on June 03 2004 05:50 EDT
-
Cayenne and session replication by Andrus Adamchik on June 03 2004 09:50 EDT
-
Cayenne and session replication by Raffaele Guidi on June 03 2004 06:54 EDT
- Cayenne and session replication by Andrus Adamchik on June 03 2004 11:16 EDT
-
Cayenne and session replication by Raffaele Guidi on June 03 2004 06:54 EDT
-
Cayenne and session replication by Andrus Adamchik on June 03 2004 09:50 EDT
-
Cayenne and session replication by Raffaele Guidi on June 03 2004 05:50 EDT
- I like the looks of this. by han theman on June 03 2004 07:28 EDT
- distributed cache by Perrin Harkins on June 02 2004 16:53 EDT
- happy user by Tore Halset on June 02 2004 17:34 EDT
- happy user by bob farmer on June 02 2004 23:55 EDT
- Use with Spring? by Tom McGee on June 02 2004 18:23 EDT
- Use with Spring? by Andrus Adamchik on June 02 2004 22:00 EDT
- Use with Spring? by Andrus Adamchik on June 03 2004 23:22 EDT
- el by Stefan Chis on June 03 2004 16:52 EDT
- el by Andrus Adamchik on June 03 2004 23:13 EDT
- my experience has been good by James Treleaven on June 08 2004 18:08 EDT
- Cayenne is invasive and non POJO isn't it? by Huw Roberts on November 19 2004 12:34 EST
-
I like the looks of this.[ Go to top ]
- Posted by: Joseph Ottinger
- Posted on: June 02 2004 14:00 EDT
- in response to Nitin Bharti
It seems wel done on first glance. Has anyone compared it with Hibernate, on a feature-by-feature basis, as well as looking at how the two perform? Is there a direct code comparison from the client side? -
distributed cache[ Go to top ]
- Posted by: Perrin Harkins
- Posted on: June 02 2004 16:53 EDT
- in response to Joseph Ottinger
So, does the distributed cache make any attempt to coordinate updates, or is it a simple last-save-wins approach? It seems like all of the open source distributed cache systems work that way, except for the JBoss one that uses JTA transactions. -
distributed cache[ Go to top ]
- Posted by: Andrus Adamchik
- Posted on: June 02 2004 17:18 EDT
- in response to Perrin Harkins
You are right - we do not attempt to implement our own distributed transactions. If you need them, use container features - Cayenne allows that.
I personally prefer "disconnected" objects and optimistic locking to some sort of coordinated distributed long running transaction monstrosity. Staying as simple and lightweight as your system allows...
Andrus -
I like the looks of this.[ Go to top ]
- Posted by: Andrus Adamchik
- Posted on: June 02 2004 17:26 EDT
- in response to Joseph Ottinger
Is there a direct code comparison from the client side?
I would like to see one myself, as this is being asked pretty often. Besides it is always good to know your own strengths and weeknesses compared to others.
My opinion (actually expressed in the article pretty well) is that ORM in Java is quickly reaching a point of becoming a commodity meaning that most of the first tier tools have all the needed features. So it all comes down to the flavor... :-)
Andrus -
Cayenne vs. Hibernate[ Go to top ]
- Posted by: j w
- Posted on: June 03 2004 04:50 EDT
- in response to Joseph Ottinger
public class _Artist extends org.objectstyle.cayenne.CayenneDataObject {...
..that's one advantage of Hibernate over Cayenne!
Of course otherwise Cayenne may have better/easier qualities over Hibernate. -
Cayenne and session replication[ Go to top ]
- Posted by: Raffaele Guidi
- Posted on: June 03 2004 05:50 EDT
- in response to j w
One of the problems I had with cayenne (I'm using 1.0 release) is that it doesn't allow deploying with session replication. What happens is that cayenne sessions seem to be locked with database connections. Now, if one servlet container dies and the other tries to use the replicated cayenne objects it gives a "global exception" because the db connection is not valid.
It also happen when (I tried it for testing purpose) the db is shut down and restarted.
Also, when this happen, cayenne cannot be reset in any way, you have to reset your app server/servlet container.
Has anyone found a workaround for this? -
Cayenne and session replication[ Go to top ]
- Posted by: Andrus Adamchik
- Posted on: June 03 2004 09:50 EDT
- in response to Raffaele Guidi
One of the problems I had with cayenne (I'm using 1.0 release)
> is that it doesn't allow deploying with session replication.
Session replication should work just fine, even in 1.0. A number of Cayenne applications were deployed using replication. So if you have any problems, please submit a bug report with details via JIRA on our site.
> What happens is that cayenne sessions seem
> to be locked with database connections.
This is strange - the whole point is that DataContext is "disconnected", so it can be deserialized and attached to any other Cayenne stack.
Andrus -
Cayenne and session replication[ Go to top ]
- Posted by: Raffaele Guidi
- Posted on: June 03 2004 18:54 EDT
- in response to Andrus Adamchik
... the whole point is that DataContext is "disconnected", so it can be deserialized and attached to any other Cayenne stack. Andrus
Ok, the problem was probably in storing DataObjects in session (for caching purposes). I think I should just avoid doing this, correct? -
Cayenne and session replication[ Go to top ]
- Posted by: Andrus Adamchik
- Posted on: June 03 2004 23:16 EDT
- in response to Raffaele Guidi
Ok, the problem was probably in storing DataObjects in session (for caching purposes). I think I should just avoid doing this, correct?
Well, I can see how this can screw up deserialization in theory. If you have concrete examples with exception stack, please still open a bug report.
Andrus -
I like the looks of this.[ Go to top ]
- Posted by: han theman
- Posted on: June 03 2004 07:28 EDT
- in response to Joseph Ottinger
Kudos to Andrus Adamchik and Eric Schneider. This is really great stuff.
Nice to have an alternative to Hibernate which, imho, is going the wrong way as JBoss will drive its development from now on.
Hurray for simplicity. -
happy user[ Go to top ]
- Posted by: Tore Halset
- Posted on: June 02 2004 17:34 EDT
- in response to Nitin Bharti
Having experience with WebObjects/EOF, I started using cayenne one year ago. It was really easy to get started, and I think it is a lot better than EOF. Cayenne is more straight forward than EOF and the open source nature of cayenne is gold.
I am currently using cayenne in two projects. One developed from the ground up with cayenne and one project upgraded to cayenne that did not use a ORM at all. I will use cayenne in my next projects as well.
The code is robust and the developers are really fixing bugs! My favorite new function in cayenne 1.1 is the new cache for all DataContexts inside a single java vm. I am not using the shared cache. The feature I am missing most is the ability to prefetch across a flattened many-to-many relationship. -
happy user[ Go to top ]
- Posted by: bob farmer
- Posted on: June 02 2004 23:55 EDT
- in response to Tore Halset
+1 from me ... as an ex-WO user, I've been using Cayenne in combination with Tapestry and am very happy with it. -
Use with Spring?[ Go to top ]
- Posted by: Tom McGee
- Posted on: June 02 2004 18:23 EDT
- in response to Nitin Bharti
Any thought of use with the Spring framework like Hibernate or iBATIS? -
Use with Spring?[ Go to top ]
- Posted by: Andrus Adamchik
- Posted on: June 02 2004 22:00 EDT
- in response to Tom McGee
Cayenne can be used with Spring pretty much out of the box. Cayenne has its own access stack, configured via CayenneModeler. All that is needed is to "mount" a Configuration object singleton in Spring, and use it as a source of DataContexts for sessions. I may write a simple factory making the process more transparent, unless somebody contributes it before I do it :-)
I guess more complex scenarios may benefit from some of the Spring features. I can think of automatically assigning an appropriate DataDomain to a user session based on some security token. But then 99% of Cayenne apps just use a single DataDomain.
Andrus -
Use with Spring?[ Go to top ]
- Posted by: Andrus Adamchik
- Posted on: June 03 2004 23:22 EDT
- in response to Tom McGee
BTW, we just started a discussion of that on cayenne-user:
http://objectstyle.org/cayenne/lists/cayenne-user/2004/06/0028.html
If you have any ideas, please jump in. -
el[ Go to top ]
- Posted by: Stefan Chis
- Posted on: June 03 2004 16:52 EDT
- in response to Nitin Bharti
Have you considered to release Cayenne expression language independently? It would make an alternative to OGNL and XPath (as used by Jakarta JXPath).
Cayenne looks nice. I'll play with it. Thanks for the article. -
el[ Go to top ]
- Posted by: Andrus Adamchik
- Posted on: June 03 2004 23:13 EDT
- in response to Stefan Chis
I actually like Cayenne expressions package a lot. This is my personal favorite feature in Cayenne 1.1. Among other things it allowed us to refactor (throw out) tons of internal code that was doing manual property and metadata navigation.
Well, sometimes I think that a standalone expressions distro is a good idea. But my current opinion is that it is not worth it (and I haven't heard otherwise from other committers). There are a few reasons:
1. I personally have no interest in maintaining such standalone package, and have no goal to compete with OGNL. I'd rather continue developing Cayenne and compete with Hibernate :-)
2. There are cool "db:" expressions, that probably don't make sense outside Cayenne.
3. The scope of the expressions package actually maps to common SQL conditions and arithmetic operations.
So there is a synergy with the rest of Cayenne, and making it more generic than it is may hurt that.
Andrus -
my experience has been good[ Go to top ]
- Posted by: James Treleaven
- Posted on: June 08 2004 18:08 EDT
- in response to Nitin Bharti
I've been using Cayenne with Tapestry, and I am quite pleased with it. The architecture feels quite elegant to me, the mailing list is friendly and helpful, and bugs are rare (and fixed quickly in any case). -
Cayenne is invasive and non POJO isn't it?[ Go to top ]
- Posted by: Huw Roberts
- Posted on: November 19 2004 12:34 EST
- in response to Nitin Bharti
It seems to me that Cayenne is one of the "invasive" bunch of persistence mechanisms. It requires your data objects to inherit from a common superclass and requires them to conform to a particular style (which is most easily produced using their mapping tool). It claims to be able to persist "POJO"s, but they don't mean the same thing as I do when they say that. For me a POJO might look like this:
class Fred {
String id;
String name;
int value;
}
If my persistence tool can persist a POJO then it ought to be able to persist instances of this class unmodified. Hibernate can do this. So can TopLink. Cayenne can't. JDO can (but only by groping my class when I'm not looking).
Huw