Yep, this is the way to do it:

> Connection conn = 
> serverRuntime.getDataDomain().getNode("nodeName").getDataSource().getConnection();

Also in 3.1 this API is streamlined a bit and can be rewritten as:

  Connection conn = serverRuntime.getDataSource("nodeName").getConnection();

Andrus

On Feb 19, 2013, at 6:18 AM, Markus Reich <markus.re...@markusreich.at> wrote:

> Hi,
> 
> I use this snippet to get a connection?
> 
> ServletContext servletContext = (ServletContext)
> FacesContext.getCurrentInstance().getExternalContext().getContext();
> CayenneRuntime cayenneRuntime = WebUtil.getCayenneRuntime(servletContext);
> ServerRuntime serverRuntime = (ServerRuntime)cayenneRuntime;
> try {
> Connection conn =
> serverRuntime.getDataDomain().getNode("nodeName").getDataSource().getConnection();
> } catch (SQLException e) {}
> 
> Meex
> 
> 
> 2013/2/19 Sampath Uppula <su0064...@techmahindra.com>
> 
>> Thanks Andrus for new version of cayenne.
>> 
>> I have requirement,
>> Is it possible to get the connection object from the ObjectContext? In
>> some cases I want run the queries for reporting using the JDBC connectivity
>> which requires the Connection object.
>> Right now I had created the connection pool separately and reading the
>> connection from the Pool this is seems to be a redundant pool.
>> If I get connection object from the ObjectContext there is no need to
>> maintain the separate Connection pool and I can directly use cayenne
>> connection pool.
>> 
>> Any thoughts?
>> 
>> Thanks,
>> Sampath Uppula.
>> 
>> 
>> 
>> -----Original Message-----
>> From: Andrus Adamchik [mailto:and...@objectstyle.org]
>> Sent: Monday, February 18, 2013 9:40 PM
>> To: user@cayenne.apache.org
>> Subject: [ANN] Cayenne 3.1B2 released
>> 
>> A second Beta of Cayenne 3.1 is available. This beta release includes more
>> complete documentation (still work in progress ... the web site contains
>> even better docs), and more than 20 bug fixes to the Modeler and the
>> runtime framework. This release goes a long way in stabilizing and
>> improving 3.1 for an average user. Very likely this will be the last beta
>> before we make a "release candidate" and 3.1 "final". Most of the remaining
>> 3.1 work will now focus on user documentation.
>> 
>> B2 is a recommended upgrade for 3.1 users. We also certainly encourage
>> everyone else to upgrade to 3.1 right now and tell us if you find any
>> problems.
>> 
>> Cayenne can be downloaded from http://cayenne.apache.org/download.html
>> 
>> A full list of changes in this release:
>> 
>>        * CAY-1737 ObjectContexts listening to DataChannel events must be
>> non-blocking
>>        * CAY-1753 remove light-superclass.vm class template
>>        * CAY-1754 Modeler suggested URL for SQLServer should start with
>> 'jdbc:sqlserver:' instead of 'jdbc:microsoft:sqlserver:'
>> Bug fixes in this release:
>> 
>>        * CAY-957 Deadlock in nested contexts
>>        * CAY-1689 [PATCH] LOB*QueryBuilders do not check
>> isQuotingSQLIdentifiers
>>        * CAY-1701 Modeler cannot undo pasting of obj (db) entity
>>        * CAY-1708 Modeler error when pasting datamap with EJBQL query
>>        * CAY-1713 Inconsistent property name:
>> "cayenne.rop.service.timeout"
>>        * CAY-1714 ROP: Cayenne tries to build a query for non committed
>> object when using more than 2 nested contexts
>>        * CAY-1715 Passing parameters to mapped EJBQL queries
>>        * CAY-1721 Writing blobs fails (Oracle)
>>        * CAY-1725 NullPointerException from call to removeToManyTarget
>>        * CAY-1727 Modeler thinks entity is using inheritance when it
>> doesn't
>>        * CAY-1729 PersistentDescriptor must have predictable property
>> iteration order
>>        * CAY-1735 Serializable IncrementalFaultList
>>        * CAY-1738 Tutorial cayenne-rop-server should be packaged as a war
>>        * CAY-1739 Cayenne ROP server resets session on every request if
>> BASIC auth is used
>>        * CAY-1741 Serializable DataObjectBaseProperty
>>        * CAY-1742 CAY-1742 ObjRelationship inspector says "ObjAttribute
>> Inspector"
>>        * CAY-1744 Unexpected read-only relationships in vertical
>> inheritance mapping
>>        * CAY-1749 NPE on simple nested context commit
>>        * CAY-1755 FaultFailureException resolving relationships to UNIQUE
>> non-PK columns
>>        * CAY-1757 ROP: Faulting entity relationship resets uncommitted
>> modifications made to its reverse relationship
>>        * CAY-1774 EhCacheQueryCache.get(QueryMetadata,
>> QueryCacheEntryFactory) returns null if EhCache instance for group is not
>> present
>>        * CAY-1783 JdbcPkGenerator.longPkFromDatabase would throw an
>> exception if the PK value exceeds a range of Java int
>> 
>> 
>> Andrus
>> 
>> ============================================================================================================================Disclaimer:
>> This message and the information contained herein is proprietary and
>> confidential and subject to the Tech Mahindra policy statement, you may
>> review the policy at <a href="http://www.techmahindra.com/Disclaimer.html
>> ">http://www.techmahindra.com/Disclaimer.html</a> externally and <a href="
>> http://tim.techmahindra.com/tim/disclaimer.html";>
>> http://tim.techmahindra.com/tim/disclaimer.html</a> internally within
>> Tech
>> Mahindra.============================================================================================================================
>> 
> 
> 
> 
> -- 
> *Markus Reich*
> Moosbach 28/2
> 6392 St. Jakob i.H.
> www.markusreich.at / www.meeximum.at
> markus.re...@markusreich.at

Reply via email to