667514 members! Sign up to stay informed.

Sponsored Links


Resources

Enterprise Java
Research Library

Get Java white papers, product information, case studies and webcasts

News News News Messages: 19 Messages: 19 Messages: 19 Printer friendly Printer friendly Printer friendly Post reply Post reply Post reply XML XML XML

TSS Article: Object Relational Mapping with Cayenne

Posted by: Nitin Bharti on June 02, 2004 DIGG
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

Threaded replies

·  TSS Article: Object Relational Mapping with Cayenne by Nitin Bharti on Wed Jun 02 12:16:56 EDT 2004
  ·  I like the looks of this. by Joseph Ottinger on Wed Jun 02 14:00:55 EDT 2004
    ·  distributed cache by Perrin Harkins on Wed Jun 02 16:53:50 EDT 2004
      ·  distributed cache by Andrus Adamchik on Wed Jun 02 17:18:39 EDT 2004
    ·  I like the looks of this. by Andrus Adamchik on Wed Jun 02 17:26:12 EDT 2004
    ·  Cayenne vs. Hibernate by j w on Thu Jun 03 04:50:28 EDT 2004
      ·  Cayenne and session replication by Raffaele Guidi on Thu Jun 03 05:50:11 EDT 2004
        ·  Cayenne and session replication by Andrus Adamchik on Thu Jun 03 09:50:00 EDT 2004
          ·  Cayenne and session replication by Raffaele Guidi on Thu Jun 03 18:54:54 EDT 2004
            ·  Cayenne and session replication by Andrus Adamchik on Thu Jun 03 23:16:45 EDT 2004
    ·  I like the looks of this. by han theman on Thu Jun 03 07:28:27 EDT 2004
  ·  happy user by Tore Halset on Wed Jun 02 17:34:06 EDT 2004
    ·  happy user by bob farmer on Wed Jun 02 23:55:46 EDT 2004
  ·  Use with Spring? by Tom McGee on Wed Jun 02 18:23:59 EDT 2004
    ·  Use with Spring? by Andrus Adamchik on Wed Jun 02 22:00:56 EDT 2004
    ·  Use with Spring? by Andrus Adamchik on Thu Jun 03 23:22:34 EDT 2004
  ·  el by Stefan Chis on Thu Jun 03 16:52:13 EDT 2004
    ·  el by Andrus Adamchik on Thu Jun 03 23:13:56 EDT 2004
  ·  my experience has been good by James Treleaven on Tue Jun 08 18:08:32 EDT 2004
  ·  Cayenne is invasive and non POJO isn't it? by Huw Roberts on Fri Nov 19 12:34:01 EST 2004
  Message #124382 Post reply Post reply Post reply Go to top Go to top Go to top

I like the looks of this.

Posted by: Joseph Ottinger on June 02, 2004 in response to Message #124362
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?

  Message #124403 Post reply Post reply Post reply Go to top Go to top Go to top

distributed cache

Posted by: Perrin Harkins on June 02, 2004 in response to Message #124382
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.

  Message #124405 Post reply Post reply Post reply Go to top Go to top Go to top

distributed cache

Posted by: Andrus Adamchik on June 02, 2004 in response to Message #124403
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

  Message #124407 Post reply Post reply Post reply Go to top Go to top Go to top

I like the looks of this.

Posted by: Andrus Adamchik on June 02, 2004 in response to Message #124382
> 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

  Message #124409 Post reply Post reply Post reply Go to top Go to top Go to top

happy user

Posted by: Tore Halset on June 02, 2004 in response to Message #124362
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.

  Message #124413 Post reply Post reply Post reply Go to top Go to top Go to top

Use with Spring?

Posted by: Tom McGee on June 02, 2004 in response to Message #124362
Any thought of use with the Spring framework like Hibernate or iBATIS?

  Message #124433 Post reply Post reply Post reply Go to top Go to top Go to top

Use with Spring?

Posted by: Andrus Adamchik on June 02, 2004 in response to Message #124413
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

  Message #124442 Post reply Post reply Post reply Go to top Go to top Go to top

happy user

Posted by: bob farmer on June 02, 2004 in response to Message #124409
+1 from me ... as an ex-WO user, I've been using Cayenne in combination with Tapestry and am very happy with it.

  Message #124459 Post reply Post reply Post reply Go to top Go to top Go to top

Cayenne vs. Hibernate

Posted by: j w on June 03, 2004 in response to Message #124382
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.

  Message #124471 Post reply Post reply Post reply Go to top Go to top Go to top

Cayenne and session replication

Posted by: Raffaele Guidi on June 03, 2004 in response to Message #124459
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?

  Message #124490 Post reply Post reply Post reply Go to top Go to top Go to top

I like the looks of this.

Posted by: han theman on June 03, 2004 in response to Message #124382
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.

  Message #124502 Post reply Post reply Post reply Go to top Go to top Go to top

Cayenne and session replication

Posted by: Andrus Adamchik on June 03, 2004 in response to Message #124471
> 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

  Message #124573 Post reply Post reply Post reply Go to top Go to top Go to top

el

Posted by: Stefan Chis on June 03, 2004 in response to Message #124362
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.

  Message #124581 Post reply Post reply Post reply Go to top Go to top Go to top

Cayenne and session replication

Posted by: Raffaele Guidi on June 03, 2004 in response to Message #124502
... 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?

  Message #124597 Post reply Post reply Post reply Go to top Go to top Go to top

el

Posted by: Andrus Adamchik on June 03, 2004 in response to Message #124573
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

  Message #124598 Post reply Post reply Post reply Go to top Go to top Go to top

Cayenne and session replication

Posted by: Andrus Adamchik on June 03, 2004 in response to Message #124581
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

  Message #124599 Post reply Post reply Post reply Go to top Go to top Go to top

Use with Spring?

Posted by: Andrus Adamchik on June 03, 2004 in response to Message #124413
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.

  Message #125130 Post reply Post reply Post reply Go to top Go to top Go to top

my experience has been good

Posted by: James Treleaven on June 08, 2004 in response to Message #124362
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).

  Message #146708 Post reply Post reply Post reply Go to top Go to top Go to top

Cayenne is invasive and non POJO isn't it?

Posted by: Huw Roberts on November 19, 2004 in response to Message #124362
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

New content on TheServerSide.comNew content on TheServerSide.comNew content on TheServerSide.com

Dependency Injection in Java EE 6 - Part 1

Reza Rahman explores the features of the proposed JSR 299, Contexts and Dependency Injection for Java EE (CDI). When approved, it promises to be a key feature of Java EE 6. (November 2, Article)

SAML: It's Not just for Web services

SAML is an XML-based standard for exchanging authentication and authorization data between security domains. The single most important problem that SAML was created to solve is the Web browser Single Sign-On problem. Many organizations are debating whether to stay with version 1.1 or move to 2.0. This article makes observations about both options. (September 28, Article)

Programming is Also Teaching Your Team

Joe Ottinger takes a look at how people learn, and applies it to the practice of programming. He notes that understanding how people learn is an essential part of working in a programming team. (September 22, Article)

Can Java EE Deliver The Asynchronous Web?

Stephen Maryka gave us an article about the Asynchronous Web and posed a number of questions that get examined like an approach to delivering Asynchronous Web capabilities through extensions to existing Java EE technologies. (July 14, Article)

JSF Flex

JavaServer Faces Flex goal is to provide users capability in creating standard Flex components, part of flexSDK which is open sourced through MPL license, as normal JSF components. This article by Ji Hoon Kim will provide an overview of creating a simple multilingual JSF page consisting of JSF Flex tags. (June 29, Article)

The Rules of SOA - A Road to a Successful SOA Implementation

In this session Jeff explores the key characteristics of successful SOA projects. He covers some of the patterns, and anti-patterns, tool sets, and strategies that he himself learned the hard way. Last, he provides a strategy and blueprint for achieving a high likelihood of success in your SOA project. (June 23, Tech Talk)

Ari Zilka Talks About Terracotta 3.1

Ari Zilka, CTO of Terracotta, Inc., talks about the new features in Terracotta 3.1, announced during JavaOne and available now. (June 15, Tech Talk)

Enterprise Application Integration, and Spring

In this Tech Talk, Josh Long explores an integration challenge using Spring Integration and walks through the implementation, employing and expanding on the basic patterns of Enterprise Application Integration to tie together components into a function integration solution, and then demonstrates how Spring Integration helps address the integration requirements. (June 15, Tech Talk)

Google Web Toolkit: An Introduction

In this Tech Talk, David Geary teaches you: The basics of Google Web Toolkit; How to implement Ajax-enabled applications in Java; Internationalization; Hooking into the browser history mechanism; Remote procedure calls. (June 4, Tech Talk)

Just Enough Early Architecture to Guide Development

Jon Kern discusses the best architecture/technical solutions and ensure that they are repeated by all developers. By tackling the architecture up-front in a serial manner, subsequent parallel development will be much more manageable and predictable. (May 28, Tech Talk)

Productive Programmer: On the Lam from the Furniture Police

This keynote describes the frustrations of modern knowledge workers in their quest to actually get some work done, and solutions for how to guard yourself against all those distractions. Neal Ford talks about environments, coding, acceleration, automation, and avoiding repetition as ways to defeat the misguided attempts to sap your ability to produce good work. (May 26, Tech Talk)

Auto-Scaling Your Existing Web Application

Gil demonstrates how new, aggressive uses of already abundant compute capacity by common applications offer competitive value for application designers. (May 21, Tech Talk)

Automating Hibernate Mapping and Queries For Java Web Development

Chris Keene introduces WaveMaker as a new way to automate the ability to generate Hibernate classes in order to more quickly bring OR mapping into an application. (May 19, Article)

Auto-Scaling Your Existing Web Application

In this session Nati Shalom demonstrates how to take a standard Java EE web application and scale it out or down dynamically without changes to the application code. Seeing as most web applications are over-provisioned to meet infrequent peak loads, this is a dramatic change because it enables growing your application as needed, when needed, without paying for unutilized resources. (May 19, Tech Talk)

Free Book PDF Download: Mastering EJB Third Edition

Mastering EJB was one of the original and most influential EJB books in the industry. Mastering EJB III now returns with two new expert co-authors, updated for EJB 2.1 and 30% new chapters including security, integration, best practices, open source, and more.
(Book PDF Download)

Application Server Matrix

The Application Server Matrix is a detailed listing of J2EE vendors and their application server products, with information on latest version numbers, J2EE spec support and licensing, pricing, platform support, and links to product downloads and reviews.
(Application Server Comparison Matrix)

News | Blogs | Discussions | Tech talks | Patterns | Reviews | White Papers | Downloads | Articles | Media kit | About
Java Solutions
All Content Copyright ©2007 TheServerSide Privacy Policy
Site Map