Re: Executing raw SQL

2012-09-05 Thread Bryan Lewis
ode").getConnection(); > > > > Andrus > > > > On Sep 4, 2012, at 2:05 PM, Bryan Lewis wrote: > > > >> In you really need to get a connection, this has worked for me: > >> > >>Connection connection = > >> > data

Re: Executing raw SQL

2012-09-04 Thread Bryan Lewis
In you really need to get a connection, this has worked for me: Connection connection = dataContext.getParentDataDomain().getNode("DataNode").getDataSource().getConnection() On Mon, Sep 3, 2012 at 8:55 PM, Bob Harner wrote: > Alternatively, how can I get access to the database connection

Re: Transaction Fails - when saving interdependent entities.

2012-06-06 Thread Bryan Lewis
This is so cool. The tip about deferred constraints allowed me to get rid of my custom EntitySorter code that I've been maintaining for years. This morning I ran scripts to drop all my foreign-key constraints and re-add them as initially deferred, for example: ALTER TABLE alert ADD FOREIGN KEY

Re: Cross Database Queries

2012-06-05 Thread Bryan Lewis
I got cross-database queries working just recently, with a boost from Michael Gentry. I'd guess the culprit is that your nodes are missing the datasource. For example: wrote: > Hi Guys, > > Just started a new project using Cayenne 3.1M3 set up some test code > to see whether I can get the cros

Re: multiple database querying

2012-05-17 Thread Bryan Lewis
Right you are. CAY-1707. On Thu, May 17, 2012 at 2:21 PM, John Huss wrote: > You should file a bug report on the JIRA. > > On Thu, May 17, 2012 at 1:01 PM, Bryan Lewis > wrote: > > > Really? When I try to set the same name for both DBEntities, the modeler > > t

Re: multiple database querying

2012-05-17 Thread Bryan Lewis
n load the DataMap in the modeler afterward. Thanks again. On Thu, May 17, 2012 at 1:38 PM, Michael Gentry wrote: > I thought the table names could be duplicated as long as the class > names were unique? > > > On Thu, May 17, 2012 at 1:18 PM, Bryan Lewis > wrote: > >

Re: multiple database querying

2012-05-17 Thread Bryan Lewis
ge the project structure to only support a single > > DataDomain." It says it was fixed in 3.1. > > > > So if we upgrade to 3.1 will we have an easier time? Are there any > > examples of querying from multiple configurations? > > > > Thanks, > > Bryan Lewis >

multiple database querying

2012-05-17 Thread Bryan Lewis
examples of querying from multiple configurations? Thanks, Bryan Lewis

Re: Finding composite key using cayenne

2012-04-20 Thread Bryan Lewis
Usually the recommended practice in Cayenne is not to use primary keys with user-meaningful values. In our shop we've learned over the years to add a simple integer PK to join tables... simpler. If it's is a join table, the two attributes are also foreign keys. You could form an expression with

Re: Error in using cayenne modeler

2012-03-26 Thread Bryan Lewis
Well, it looks like you got past the inability to connect. Now Oracle (not Cayenne) is complaining that the Artist table doesn't exist. On Mon, Mar 26, 2012 at 6:43 AM, yunus wrote: > thanx guys.Ur suggestion helped me alot.but now i am facing this new > error.Please help in this.. > > Mar 26,

Re: Error in using cayenne modeler

2012-03-26 Thread Bryan Lewis
It looks like a simple case of not being able to connect to the Oracle database. It's happening the very first time Cayenne tries to connect. Some other error message might've suggested an invalid URL, but your URL syntax looks correct. I'd make sure that the server can connect to the database w

Re: Odd error

2012-02-06 Thread Bryan Lewis
This error reminds me of something we see in our shop. If multiple related entities are being committed together, Cayenne can sometimes commit them out of order which can cause FK constraint violations. The commit order seems to be indeterminate; it can work as expected on a dev machine and fail

Re: possible bug with inherited cayenne objects and mandatory fields

2011-02-17 Thread Bryan Lewis
Agreed. We've started following that practice too. Always assign a simple unrelated primary key. Consistent, avoids surprises. On Thu, Feb 17, 2011 at 9:09 AM, Mike Kienenberger wrote: > Solution C: assign a meaningless primary key to the join table. > > Obviously, this isn't an option for ev

Re: possible bug with inherited cayenne objects and mandatory fields

2011-02-17 Thread Bryan Lewis
This sounds like the same problem we've lived with for years. In a complicated model (hundreds of entities for us), Cayenne's graph-following algorithm (AshwoodEntitySorter) doesn't have enough information to perform all the commits in exactly the right order. (Perhaps this is an argument for sup

Re: Modified Fields

2010-11-01 Thread Bryan Lewis
I've written code that logs changes to the database. I'm appending it below with some disclaimers. It's stable -- we've been using it in production for several years now -- but it might be more complicated than you need. I've boiled it down somewhat here... removed the frill of ignoring a set of

Re: cayenne-plugin and superpkg

2010-10-12 Thread Bryan Lewis
The elements are case-sensitive. Try . (I'd fix the case of "DataMap.map.xml" too, although it might not matter on Windows.) On Tue, Oct 12, 2010 at 4:55 PM, André Rothe wrote: > Hello, > > I have written a configuration for the class generator of Cayenne within my > pom.xml: > > > org.apa

timing issue?

2010-07-20 Thread Bryan Lewis
We released a new internal web app at the start of the month and we've noticed some troublesome behavior. After the insertion or deletion of an object, a to-many relationship can occasionally get out of sync. For example, we have a Company entity with a to-many relationship to Task. After the use

Re: Further on Cache Groups

2010-05-31 Thread Bryan Lewis
I debugged through your test case to learn more about caching. The problem is that QueryCache's method names are misleading when running with OSCache. QueryCache.removeGroup() doesn't actually remove anything from the OSCache. It calls osCache.flushGroup(). Similarly, clear() doesn't empty the ca

Re: Removing Cayenne cache groups

2010-05-27 Thread Bryan Lewis
Okay, CAY-1436. On Thu, May 27, 2010 at 11:04 AM, Andrus Adamchik wrote: > > On May 27, 2010, at 5:48 PM, Bryan Lewis wrote: > > I couldn't get OSCache to work at first. I stepped through the code and >> learned that the queryCacheFactory isn't created unless the &

Re: Removing Cayenne cache groups

2010-05-27 Thread Bryan Lewis
This email made me aware of that cool new removeGroup and OSCache features. Thanks. Two little howevers... In my testing, it worked only with LOCAL_CACHE, as the original poster said. Not a big deal for me; SHARED_CACHE is rarely necessary. The same was true with OSCache. I couldn't get OSCach

Re: Relationship Fetching Behavior and Case Sensetivity

2010-05-27 Thread Bryan Lewis
Tossing in my vote... yes, it would be nice to have an easier way to override the fault resolution. We've had referential integrity problems for a long time, dealing with a legacy database. My fix has been to subclass DataContext and catch the FaultFailureException in prepareForAccess(). That's

can't run maven-cayenne-plugin

2010-05-16 Thread Bryan Lewis
I upgraded the cayenne version from 3.0RC1 to 3.0 in my application's pom.xml. All went well except the maven-cayenne-plugin (m2eclipse auto-executing cgen) throws: Build errors for model; org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.cayenne.plugins:ma

Re: OptimisticLocking exception during cascade delete

2010-04-15 Thread Bryan Lewis
Hmm, that's very strange. Now the double deletion isn't happening. I don't think I changed anything relevant but I can't make it happen now. Oh well, never mind. On Thu, Apr 15, 2010 at 12:32 PM, Bryan Lewis wrote: > I have an entity Quote with a to-many relationship

OptimisticLocking exception during cascade delete

2010-04-15 Thread Bryan Lewis
I have an entity Quote with a to-many relationship to QuoteCountry, and a cascade delete rule. When I delete a quote object, Cayenne attempts to delete the QuoteCountry objects twice, I suspect because I also have a flattened relationship quote.countries (Quote -> QuoteCountry -> Country). I was

Re: Optimistic Locking problem

2010-04-11 Thread Bryan Lewis
Did you select any attribute to be "Used for Locking" in the modeler? In the Attributes view. On Sun, Apr 11, 2010 at 1:40 PM, Marek Šabo wrote: > Hi all, > > I would like to ask a question abou OL, I'm using cayenne filter along > with wicket and I set OL through cayenne modeller and double-c

Re: BUG: Cayenne Modeler

2010-02-02 Thread Bryan Lewis
Sure, but you can run the modeler with an increased heap size, like java.exe -Xmx512m -jar CayenneModeler.jar On Mon, Feb 1, 2010 at 11:25 PM, Joe Baldwin wrote: > The CayenneModeler crashed not my app. > > > > > On Feb 1, 2010, at 11:07 PM, Kevin Menard wrote: > > > Hi Joe, > > > > It looks l

Re: DataObject expiring?

2010-01-06 Thread Bryan Lewis
t; > Weak references in Cayenne 3.0 are at the ObjectStore level and should not > affect relationships, if Java works correctly. I.e. related objects are > store via hard references. > > Andrus > > > > > On Jan 6, 2010, at 4:45 AM, Bryan Lewis wrote: > > This rings a

Re: DataObject expiring?

2010-01-05 Thread Bryan Lewis
This rings a bit of a bell with me. We made our first big release with Cayenne 3.0 a couple of weeks ago (it went well, thank you) and saw a similar-sounding problem. It happened only intermittently and only on our production server. We could never reproduce it on our test server, let alone in a

Re: failure to commit part of the changes

2009-11-02 Thread Bryan Lewis
Resending my last post. The list rejected it as spam, probably because I sent two posts in the same minute. Now that I've had a day to cogitate on it and to re-read CAY-1008, the issue > I addressed in my "model validation" code wasn't the important one. Having > redundant DbRelationships isn't

Re: failure to commit part of the changes

2009-11-02 Thread Bryan Lewis
I don't think so. One of my patches merely prints more details about the auto-supplied runtimeRelationships at startup. The Jira is talking about formatting the QueryLogging throughout the session. Sort of related, I guess, in that both are trying to improve the readability of the log. On Mon,

Re: failure to commit part of the changes

2009-10-31 Thread Bryan Lewis
reference to runtimeRelationship42, I can refer to the start of the log to see the entities and attributes. On Fri, Oct 30, 2009 at 5:48 PM, Bryan Lewis wrote: > A weird one here... I'm looking for advice on how to debug it. Using > Cayenne 3.0M6 on Oracle 8 (but for once I don

failure to commit part of the changes

2009-10-30 Thread Bryan Lewis
to avoid runtimeRelationships? I suppose I could step through the Cayenne's traversal of the object graph in the debugger, if nobody has any tips. Thanks, Bryan Lewis

Re: DataContext, webapp and serialization

2009-10-30 Thread Bryan Lewis
We had a similar problem. We had several variants of cayenne.xml and one was chosen by our model code at run-time. However Tomcat by default serializes sessions and recreates them at start-up, before our code gets a chance to do its thing. We had an instance of our model stored in the Visit, whi

ClassCastException with OracleLOBBatchAction

2009-06-29 Thread Bryan Lewis
One more bug report related to Oracle, although this one might not be specific to Oracle8. DataDomainActionBuilder.batchAction calls delegate.batchAction(): public SQLAction batchAction(BatchQuery query) { return new DataDomainBatchAction(domain, (BatchAction) delegate.batchAction(que

Re: change in query behavior with orExp and a join

2009-06-29 Thread Bryan Lewis
t; WHERE (t1.NIC_ID_SOURCE = ?) OR (t1.NIC_ID_SUBJECT = ?) > > > > > > On Fri, Jun 26, 2009 at 3:48 PM, Bryan Lewis wrote: > >> We upgraded to Cayenne3 this week and things are going well, except for >> this one query. >> >> Expression exp = >

Re: change in query behavior with orExp and a join

2009-06-27 Thread Bryan Lewis
3:48 PM, Bryan Lewis wrote: > We upgraded to Cayenne3 this week and things are going well, except for > this one query. > > Expression exp = > ExpressionFactory.matchExp("tradeSource.sourceCompany", fromCompany); > exp = > exp.orExp(ExpressionFactory.

change in query behavior with orExp and a join

2009-06-26 Thread Bryan Lewis
We upgraded to Cayenne3 this week and things are going well, except for this one query. Expression exp = ExpressionFactory.matchExp("tradeSource.sourceCompany", fromCompany); exp = exp.orExp(ExpressionFactory.matchExp("tradeSource.subjectCompany", fromCompany)); SelectQuery

Re: Cayenne 3 with Oracle 8

2009-04-13 Thread Bryan Lewis
m Hudson CI once it rebuilds my > latest changes: > > > http://hudson.zones.apache.org/hudson/view/Cayenne/job/Cayenne-trunk/org.apache.cayenne$cayenne-server/ > > Andrus > > > > On Apr 13, 2009, at 7:58 PM, Bryan Lewis wrote: > > Thanks. About what I thought.

Re: Cayenne 3 with Oracle 8

2009-04-13 Thread Bryan Lewis
= t2.x. I > > suppose the old oracle inner join support could be added back in. > > > > Outer join support is even worse for 8, and not implementable for all > > practical purposes. > > > > > > On Mon, Apr 13, 2009 at 12:32 PM, Bryan Lewis > wr

Cayenne 3 with Oracle 8

2009-04-13 Thread Bryan Lewis
We have some apps running on an Oracle 8i database. Wow, almost 10 years old. Cayenne 2 has been working great. When I tried updating to Cayenne 3, I got a syntax error in a particular bit of SQL with a JOIN. This isn't an urgent problem for us but I thought I'd mention it. We have an Employee

Re: pruning the querylogger

2009-04-05 Thread Bryan Lewis
Cool, works well. Thanks. On 4/5/09, Andrus Adamchik wrote: > Hi Bryan, > > Log4J itself should be used to configure things like this. You can > have a custom appender for instance with some thread-local API to turn > it on and off. > > Andrus > > On Apr 3, 2009, at

pruning the querylogger

2009-04-03 Thread Bryan Lewis
This might be an obvious question but I couldn't find it in the list and docs. In our old Cayenne-2-based apps, we selectively pruned the query logging to avoid cluttering our log files with uninteresting repetitive queries. We used QueryLogger.setLoggingLevel() before each performQuery(). Yeah,

Re: Any way to check if object has really changed?

2009-03-24 Thread Bryan Lewis
Yep, we've been using essentially the same code to detect real changes to objects so that we can keep an audit trail of all changes. However, we did run into one little special case. If the object has a to-one relationship that's toDependentPK, and it happens to have a null current value, it will

Re: building 3.0 cayenne source

2009-03-16 Thread Bryan Lewis
o I could >> single-step into it occasionally. Some of the imports appear to be >> JDK-6-dependent, such as java.sql.NClob and SQLXML. What's the recommended >> practice? Install both versions 5 and 6 of the JDK? >> >> Thanks, >> Bryan Lewis >> > >

Re: [C3] logging

2007-09-14 Thread Bryan Lewis
You might be amused by this blog posting: http://arsenalist.com/2007/09/12/logging-abstraction-is-utterly-pointless/ Michael Gentry wrote: > I thought that part was amusing. I have no vested interest in any > logging decision. I was rather happy with printf() in my C code. :-) > However, af

Re: Cayenne Query trivia

2007-07-17 Thread Bryan Lewis
Awesome. I can use that. Ummm... could it be made to take a Map of parameters? I could do it by adding a statement involving expWithParameters(), right? Andrus Adamchik wrote: > Here is a small custom query that combines SQLTemplate and SelectQuery > in one, allowing to fetch the root entity w

Re: problems with Oracle stored procedure

2007-07-09 Thread Bryan Lewis
Let me know if I can help test, although my being on an older Oracle version (8.1.6) might make me non-useful. Our apps use a few stored procedures that take no arguments and return nothing, and they've been working fine. I created Greg's do-nothing procedure and did not get the infinite loop.

Re: problems with Oracle stored procedure

2007-07-06 Thread Bryan Lewis
This sounds very similar to a problem I had last year. I got an infinite loop of "updated rows" log messages on Oracle. See CAY-464 at https://issues.apache.org/cayenne/browse/CAY-464 Maybe it won't help -- we thought the problem appeared only on an older version of Oracle -- but it's worth a tr

Re: SQLTemplate not faulting an object

2007-06-05 Thread Bryan Lewis
The case-setting methods sound like a fairly good idea. We're currently running on Oracle but preparing to convert to Postgres. I sometimes have to adjust the case of the column names in SQLTemplate sql, so those methods might help with that. However, they wouldn't be a cure-all. I'd still need

Re: Cayenne version 1 vs. version 2

2007-05-25 Thread Bryan Lewis
I switched from Cayenne 1.2 to 2.0 last December and had no trouble at all. I did a global replace of the package names in my source and xml config files and it worked fine. Fredrik Liden wrote: > Hi, > > I had created a project using Cayenne version 1.2 a while back. > Is it correct that the o

Re: How do I get a record for non integer pk?

2007-05-16 Thread Bryan Lewis
We use that objectForPK() method routinely with a String key and haven't had any problems. What do you mean by "not working"? Is it throwing a CayenneRuntimeException? Frank wrote: > Hello, > > The code below is not working, as it expects the PK to be integer. > There is only one String field in

Re: Temporary Objects

2007-03-27 Thread Bryan Lewis
Aristedes Maniatis wrote: > > Objects will only be given their primary key after they are committed > to the database. However 9 times out of 10, users new to Cayenne who > want to use the pk for something find that there is a better way which > doesn't involve using the primary key. What do you wa

Re: Cayenne modeler

2007-03-16 Thread Bryan Lewis
Try: http://cwiki.apache.org/confluence/display/CAYDOC/Setting+DataMap+Defaults syrinx wrote: > I would like to know if it's possible to change the configuration of the > modeler in some way, so that a "class entity" would be generated as a > subclass of a "my custom class" instead of > org.apac

SQLTemplate fetchLimit

2007-02-16 Thread Bryan Lewis
Just checking my understanding of something... Does it make any sense to call setFetchLimit() on a SQLTemplate? We're supplying the raw SQL so I would think we'd have to hand-craft the fetch limit as well, say with a 'rownum' or 'limit'.

Re: can't find procedure without a parameter on Postgres

2007-02-08 Thread Bryan Lewis
Thanks! Andrus Adamchik wrote: > Bryan, > > this is a bug, I can confirm that: > > https://issues.apache.org/cayenne/browse/CAY-750 > > I fixed it on trunk (Cayenne 3.0). Will apply it to 2.0 and 1.2 > branches shortly. > > Andrus > > > On Feb 6, 2007, at

can't find procedure without a parameter on Postgres

2007-02-06 Thread Bryan Lewis
I had this code working on an Oracle8 database: ProcedureQuery procQuery = new ProcedureQuery("proc_eu_update_begin"); dc.performQuery(procQuery); The procedure is only a few sql statements to create a temporary table and takes no parameters. When I ported to Postgres 8.2, Cayenn