Return-Path: X-Original-To: apmail-cayenne-user-archive@www.apache.org Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 039C791A8 for ; Tue, 6 Dec 2011 15:05:11 +0000 (UTC) Received: (qmail 67493 invoked by uid 500); 6 Dec 2011 15:05:10 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 67470 invoked by uid 500); 6 Dec 2011 15:05:10 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 67462 invoked by uid 99); 6 Dec 2011 15:05:10 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Dec 2011 15:05:10 +0000 X-ASF-Spam-Status: No, hits=1.8 required=5.0 tests=FREEMAIL_FROM,HTML_FONT_FACE_BAD,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of johnthuss@gmail.com designates 209.85.216.171 as permitted sender) Received: from [209.85.216.171] (HELO mail-qy0-f171.google.com) (209.85.216.171) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Dec 2011 15:05:04 +0000 Received: by qcsc20 with SMTP id c20so3383972qcs.16 for ; Tue, 06 Dec 2011 07:04:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=2wlUSzPW9K4ulGgp+YXRfLGkD3Gnwr5pIJMe1Rgw9gA=; b=xYkA/UXUP+uvtVY+VV3yP4A7oZvinQyl9OwnQhYzYMnkwuq1dknf4yFTdksjhyR5cH OkpSt8uUqq3MAahZfMU1Ep8yG1BzjWwHWZTzhIZB+FE9U7y+qSTgpbn7DWgf3yBfJg0z tzb4AS6qVhjQ++raLjrvXQVq5in5OOZXjjt6A= MIME-Version: 1.0 Received: by 10.229.85.193 with SMTP id p1mr3139661qcl.152.1323183882835; Tue, 06 Dec 2011 07:04:42 -0800 (PST) Received: by 10.229.110.20 with HTTP; Tue, 6 Dec 2011 07:04:42 -0800 (PST) In-Reply-To: <4EDDBD57.15981.18B000@kevin.kmz.co.za> References: <4EDDBD57.15981.18B000@kevin.kmz.co.za> Date: Tue, 6 Dec 2011 09:04:42 -0600 Message-ID: Subject: Re: Is it possible/easy to integrate cayenne with other frameworks? From: John Huss To: user@cayenne.apache.org Content-Type: multipart/alternative; boundary=0016368323d44f15da04b36dc18e X-Virus-Checked: Checked by ClamAV on apache.org --0016368323d44f15da04b36dc18e Content-Type: text/plain; charset=ISO-8859-1 For the DB connection, if you're using 3.0 there is some info here: https://cwiki.apache.org/CAY/setting-database-connection.html For 3.1, you can use a properties file to store the value and load them in a custom DI module by doing something like: public class PropertiesModule implements Module { public void configure(Binder binder) { MapBuilder mapBuilder = binder.bindMap(DefaultRuntimeProperties.PROPERTIES_MAP); Properties props = ... load properties from a file for (Object keyObj : props.keySet()) { String key = (String)keyObj; mapBuilder.put(key, props.get(key)); } } } Where the properties are set like this: cayenne.jdbc.driver.MyDomain.MyNode=org.postgresql.Driver cayenne.jdbc.url.MyDomain.MyNode=jdbc:postgresql://localhost/mydb cayenne.jdbc.username.MyDomain.MyNode=postgres cayenne.jdbc.password.MyDomain.MyNode=******* cayenne.min.connections.MyDomain.MyNode=1 cayenne.max.connections.MyDomain.MyNode=1 You can use Cayenne without running the modeler, but it would be rather cumbersome since you would have to create the whole model programmatically at runtime each time. And normally you would generate custom classes for your Entities (objects), but without having a pre-existing model you would just have to use CayenneDataObject directly which will force you to access values by name instead of via getters and setters. If those requirements are acceptable, then it could work. The "update" method might be tricker. Cayenne saves all changes to the entire object graph at once; you can't just save one object, you save all changes to the related objects that are loaded and modified. If this is different than the "update" concept in Isis then it may be a problem. John On Tue, Dec 6, 2011 at 12:59 AM, Kevin Meyer - KMZ wrote: > Hi all, > > Please point me to the previous message if this has already been > addressed.. I did a quick search, but couldn't find anything that looked > directly relevant. > > Anyway: I have been maintaining the SQL Objectstore (jdbc) for > Apache Isis (currently in the incubator), and would like to know if > Cayenne can be used completely "in the background", with no user > integration (i.e. no need to run the configuration tool / modeller / etc). > > Isis is a complete framework solution for developing and deploying > POJO / domain objects, and provides hooks for persistence tasks. > For example, the metamodel context provide: > public ObjectInstantiator getObjectInstantiator(); > public ObjectDirtier getObjectDirtier(); > public ObjectPersistor getObjectPersistor(); > > where, for example: > public interface ObjectInstantiator extends Injectable { > /** > * Provided by the ObjectFactory when used by framework. > * > *

> * Called by {@link ObjectSpecificationDefault}. > */ > Object instantiate(Class cls) throws > ObjectInstantiationException; > } > > Isis requires no annotations, etc, to support persistence, which is > taken care of via introspection. Some hints can be provided to the > objectstore via the "isis.properties" file, if required. > > So, I would like to know how difficult would it be to "just" hook Cayenne > into the object "create", "find" and "update" methods of Isis, and let > Cayenne take care of the ORM / persistence? > > Taking a quick browse through the examples, I don't see where I > configure the database connection, for example. > > Regards, > Kevin > > > --0016368323d44f15da04b36dc18e--