Re: Database generation SQL script creation in background

2012-08-13 Thread John Huss
For what purpose? What is your broader goal? There are a few different ways of creating the scheme using Cayenne. John On Monday, August 13, 2012, Martin Weber wrote: > Hi, > > Is there a solution to create the database generation SQL script without > starting the GUI modeler ? I would like to

Re: Database generation SQL script creation in background

2012-08-14 Thread John Huss
at. > > Cheers, > Martin > > > On 14.08.2012 05:38, John Huss wrote: > >> For what purpose? What is your broader goal? There are a few different >> ways of creating the scheme using Cayenne. >> >> John >> >> On Monday, August 13, 2012, Martin

Re: Writing to an unmapped property

2012-09-12 Thread John Huss
I think you have to expose C. I believe "unmapped" means not defined in modeler, like if you add some instance variables that are not persisted. John On Wed, Sep 12, 2012 at 6:56 AM, wrote: > Hi > > The API says that readNestedProperty supports both mapped and unmapped > properties. I assume t

Re: 3.1B1 Validation Exception

2012-09-19 Thread John Huss
That doesn't sound like the right behavior. Can you create small example that reproduces the problem? On Wednesday, September 19, 2012, wrote: > Is this a bug or am I doing something wrong ? > > I'm using 3.1B1 and getting a validation exception BEFORE my onPrePersist > lifecycle method is calle

Re: Can I select new objects via performQuery.

2012-11-06 Thread John Huss
You could just support SelectQuery fairly easily though, couldn't you? Project Wonder has this - you can do fetchSpec.setIncludeEditingContextChanges(true). On Tue, Nov 6, 2012 at 3:22 PM, Andrus Adamchik wrote: > > On Nov 6, 2012, at 11:58 PM, Aristedes Maniatis wrote: > > > Andrus, I wonder

Re: Can I select new objects via performQuery.

2012-11-07 Thread John Huss
ther new or edited) which > match the query > > > > It would either throw an exception or fail silently if the query was > unable to be evaluated in memory. Not sure which is better. > > > > Ari > > > > On 7/11/12 8:43am, John Hu

Re: adding new columns to table

2012-11-24 Thread John Huss
There is an experimental library in the cayenne-sandbox you could try: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-migrations/ I'm using it in production, but your mileage may vary. The migrations are not automatically generated (except for the initial database) but they are easy to writ

Re: Problem in fetching the data from multiple tables with relationships.

2012-12-12 Thread John Huss
I'm not really sure what your question is. Cayenne will fetch all of the fields that are modeled and turn them into objects. And you can add prefetching paths to your SelectQuery to pre-fetch the related objects, otherwise they will be loaded when accessed. If you want to write your own SQL and

Re: Add ActiveRecord support to Cayenne

2012-12-18 Thread John Huss
I would welcome the addition of some DAO (data access object) methods in the entity templates that make it even easier to query the DB. For example I have these defined in my entity template: public static List fetchAll(ObjectContext ec); public static List fetchAll(ObjectContext ec, List sortOr

Re: basic tutorial

2012-12-21 Thread John Huss
This message should be on the user mailing list, not the dev list, so please reply there. Cayenne is not primarily intended to be used that way, so there is no tutorial. It is possible to do, but there's not really a good reason to for a beginner. Using the modeler prevents from having to know t

Re: BaseContext

2013-02-14 Thread John Huss
Try: parentObject = myNewContext.localObject(parentObject); Then proceed with the rest. Then both objects will be in the same ObjectContext. On Thu, Feb 14, 2013 at 9:08 AM, Rich Tuers wrote: > >Hello, > > > >We are using Cayenne 3.0 and recently implemented the > >WebApplicationContextFilte

Re: BaseContext

2013-02-14 Thread John Huss
his code since I was getting the exception. > // Trying to figure out how to avoid this exception > return DataContext.createDataContext(); > } > } > > > > Thanks, > Rich > > > > > > On 2/14/13 8:24 AM, "John Hus

Re: ServerRuntime Best Practice? [3.1]

2013-02-28 Thread John Huss
If it's a servlet app, then the runtime is created in CayenneFilter and bound to the thread for each request and you access it via WebUtil.getCayenneRuntime(servletContext); Or you can get a context from the injector if you have bound that to a thread: ObjectContext context = CayenneRuntime.get

Re: Unit Testing cayenne apps

2013-04-23 Thread John Huss
You can configure the database connection in 3.1 with a module like: import org.apache.cayenne.configuration.Constants; import org.apache.cayenne.di.Binder; import org.apache.cayenne.di.Module; public class AppModule implements Module { public void configure(Binder binder) { binder.bindMap(Cons

Re: ROP security

2013-05-16 Thread John Huss
Here's some code we started on to do this kind of thing. It never made it to production, but it was close. This just defines some methods that can be overridden to implement security based on your specific requirements. https://www.dropbox.com/s/g247uxpalps5xse/AuthHessianService.java One thing

Re: Swing / Data views

2013-06-02 Thread John Huss
+1 I have used jgoodies binding with cayenne in just that way. IMHO it's the best binding library considering that the one that was supposed to become standard has ceased to be developed. John On Saturday, June 1, 2013, Dirk Olmes wrote: > On 05/31/2013 06:24 PM, Andrus Adamchik wrote: > > On t

Re: caching questions

2013-07-02 Thread John Huss
I'd love to learn more about caching too. Great info and questions - looking forward to the response. On Mon, Jul 1, 2013 at 9:25 PM, Aristedes Maniatis wrote: > Hi Andrus > > I know you have been looking at this offline, but I thought I'd raise this > here in public to see if others can also

Re: Which Cayenne Version to use ?

2013-07-23 Thread John Huss
We're basically running off of trunk as well for our three sites, one with very heavy traffic. I think the decision depends on whether or not there are APIs or features in 3.2 or 3.1 that you really want. If so, there is really very little risk. But if there are no new features you care about, t

Re: Unit Testing WebApp with 3.2M1 release

2013-07-24 Thread John Huss
getContext() was renamed to newContext() On Wed, Jul 24, 2013 at 3:51 PM, Markus Reich wrote: > Hi, > > I'm using following code for unit testing: > > package db; > > import org.apache.cayenne.ObjectContext; > import org.apache.cayenne.access.DataContext; > import org.apache.cayenne.configuratio

Re: Child Contexts

2013-09-05 Thread John Huss
You have to assign the result of localObject. John On Sep 5, 2013 12:59 AM, "Markus Reich" wrote: > Hi, > > I've a question concering child contexts, when I add an object to a child > context with method localObject, I thought the object is really from parent > to child context? > > But when I r

Re: Child Contexts

2013-09-05 Thread John Huss
()); > } > > and I thought the commitChangesToParent() moves the object from child to > parent context? So after the commitToParent() the data is written and > committed to db? > > regards > Meex > > > > 2013/9/5 John Huss > > > You have to assign the resu

Re: Optimistic Locking

2013-09-13 Thread John Huss
There is an "Optimistic Locking?" checkbox for each ObjEntity in CayenneModeler that will turn it on or off. If you want to do it ad-hoc at runtime you have to catch the exception and then refetch the problem object (possibly repeatedly) and re-apply the changes. It's a little messy. On Fri, Se

Re: DB default values

2013-09-17 Thread John Huss
In regard to which fields you set, it really doesn't matter - the Java defaults are completely separate from the DB defaults, so it's up to you. The DB defaults are not utilized by Cayenne at all. John On Tue, Sep 17, 2013 at 8:11 AM, Michael Gentry wrote: > Hello Markus, > > You should create

Re: Creating a new ServerRuntime from an existing ServerRuntime

2013-09-27 Thread John Huss
I've had to make a copy of a ServerRuntime object before too - an API for it would be useful. On Fri, Sep 27, 2013 at 11:39 AM, Mike Kienenberger wrote: > So it looks like I can reuse modules to create my own runtime. > However, the current 3.1 API isn't very friendly toward this approach. > I h

Re: Creating a new ServerRuntime from an existing ServerRuntime

2013-09-27 Thread John Huss
In my case the copy was the same. The point was to create a separate DB connection pool for background tasks to use so that they could do DB intensive tasks without impacting the main DB connection pool. I see your point though. On Fri, Sep 27, 2013 at 11:49 AM, Andrus Adamchik wrote: > > So i

Get (really) modified objects

2013-10-08 Thread John Huss
After calling objectContext.commitChanges() need to be able to find out what objects were actually changed by the commit. Since objectContext.getModifiedObjects() includes phantom (noop) changes I can't use that. I also preferably need have this info in the local scope immediately after commit, n

Re: Get (really) modified objects

2013-10-08 Thread John Huss
e to call newObjects/deletedObjects, too, if you care > about those). Let me know if that'll be sufficient and I'll dig it up for > you. > > mrg > > PS. I've only done moderate testing of it, so a second set of eyes wouldn't > hurt to verify it actually works correc

Re: Migrating web application from 3.0 to 3.1

2013-11-06 Thread John Huss
Assuming your using a servlet container: 1) Add CayenneFilter to your web.xml http://cayenne.apache.org/docs/3.1/api/org/apache/cayenne/configuration/web/CayenneFilter.html 2) Retrieve the ServerRuntime using WebUtil.getCayenneRuntime http://cayenne.apache.org/docs/3.1/api/org/apache/cayenne/conf

Re: 3.2M1 first impressions

2013-11-11 Thread John Huss
objectForQuery = ObjectContext.selectOne I'm not in front of the code right now, but I believe the type parameter is unbounded to allow for fetching data rows as well, which are not DataObjects or Persistent or anything. John On Mon, Nov 11, 2013 at 11:48 AM, Ramiro Aparicio < ramiro.apari...@p

Creating a second runtime with different number of max connections

2013-11-14 Thread John Huss
I'm having trouble overriding the max number of database connections when creating a second ServerRuntime. I have a module like this: public class BackgroundModule implements Module { @Override public void configure(Binder binder) { binder.bindMap(Constants.PROPERTIES_MAP)

Re: Trimming strings

2014-02-11 Thread John Huss
You can subclass CayenneDataObject and override writePropertyDirectly. That should do it. On Tue, Feb 11, 2014 at 1:10 PM, Richard Frovarp wrote: > Upon insert I want to trim strings going into the database. Is there an > easy way to configure this? > > I know I can override all of the appropri

Re: How to use cayenne-migrations

2014-03-22 Thread John Huss
Ah, sorry, the pom wasn't really right due to my lack of maven knowledge. If you update it should work now. Thanks! On Sat, Mar 22, 2014 at 1:42 AM, D Tim Cummings wrote: > I would like to try using cayenne-migrations to do database schema updates > when my application starts but I am not sur

Re: How to use cayenne-migrations

2014-03-22 Thread John Huss
Also, you should know that you can generate your initial migration from your DataMap using MigrationGenerator. So take advantage of that. On Sat, Mar 22, 2014 at 9:40 AM, John Huss wrote: > Ah, sorry, the pom wasn't really right due to my lack of maven knowledge. > If you updat

Re: How to use cayenne-migrations

2014-03-24 Thread John Huss
I usually run MigrationGenerator from eclipse. You can just create a new "Java Application" launch configuration for the project and enter "org.apache.cayenne.migration.MigrationGenerator" as the main class. And then on the arguments tab enter your cayenne project filename and the output director

Re: How to use cayenne-migrations

2014-03-25 Thread John Huss
="true" isMandatory="true" length="10"/> > > > > So my question is, how do I get cayenne-migrations to create the > auto_increment in MySQL. > I'll have to look into that. You can do it manually by extending SqlFileMigration and adding an sql fi

Re: Build Query

2014-05-11 Thread John Huss
I'm not a maven guy, and had never used mvn verify before. I usually just do a full build with "mvn clean install". But I did just try it and verify succeeds for me both on STABLE-3.1 and on trunk. On Wed, May 7, 2014 at 3:51 AM, Andrew Lindesay wrote: > Hello; > > I'm trying to add some addi

Re: Which version?

2014-08-06 Thread John Huss
3.2! On Aug 6, 2014 7:12 PM, "Lon Varscsak" wrote: > Hey guys, > > It's been a while since I've used Cayenne and tinkering with a new project. > Should I be using 3.2M1 (June 2013) or 3.1RC1 (Feb 2014) for a new > project? > > -Lon >

Re: Eclipse/Modeler/Magic

2014-08-07 Thread John Huss
On Thu, Aug 7, 2014 at 12:35 PM, Lon Varscsak wrote: > Hey guys, > > A couple fo questions about class generation: > > 1) Is it possible to trigger (from within Eclipse) an automated build of > the classes when the model file changes? I had this with WebObjects/WOLips > and it's such nice featur

Re: Eclipse/Modeler/Magic

2014-08-07 Thread John Huss
Also, you can vote for this feature here: https://issues.apache.org/jira/browse/CAY-1723 On Thu, Aug 7, 2014 at 1:49 PM, John Huss wrote: > On Thu, Aug 7, 2014 at 12:35 PM, Lon Varscsak > wrote: > >> Hey guys, >> >> A couple fo questions about class generation:

Re: Alternate connection for prod/dev

2014-08-13 Thread John Huss
You can configure the database connection in 3.1+ with a cayenne module like: import org.apache.cayenne.configuration.Constants; import org.apache.cayenne.di.Binder; import org.apache.cayenne.di.Module; public class AppModule implements Module { public void configure(Binder binder) { binder.bin

Re: Version Compatibility

2014-08-15 Thread John Huss
The version of MySQL depends only on your JDBC driver, it doesn't matter to cayenne (well, it shouldn't). Tomcat is completely unrelated too. But "as much as possible" is a bad recommendation. So the Java version is all that matters, and like you said 3.1 requires Java 1.5+ On Fri, Aug 15, 2

Re: Batch fetching relationships

2014-08-15 Thread John Huss
Cayenne's prefetches give you more options, specifically the *disjoint* prefetch type. If you batch relationship fetching is in the same place as the query this is the best way to translate it. However, if your batch relationship fetching is elsewhere where the query isn't available, currently I

Re: Batch fetching relationships

2014-08-24 Thread John Huss
On Fri, Aug 15, 2014 at 7:26 PM, Aristedes Maniatis wrote: > > What ever became of EOF/WO? Is it still kicking around somewhere with > Project Wonder reverse engineering the WO code in order to fix bugs and add > features? WOlips was a great model editing tool... > Yep, that's right. It's still

Overriding database connection properties in merged projects

2014-09-09 Thread John Huss
I'm doing my first merged project where I want to use two separate DataDomains (projects) in a single cayenne runtime. However, it doesn't work because the properties that change the database connection are not being used. For example: cayenne.jdbc.url.MyDomain.MyNode=jdbc:postgresql://localhost

Re: Cayenne Modeler

2014-10-30 Thread John Huss
On the ObjEntity screen pressing "Sync" button (the one with the two arrows will create any missing ObjAttributes from DbAttributes. But primary key / foreign key fields have to be added to the ObjEntity manually. You could uncheck the pk box and then sync, then check it again, but that's probabl

Re: Custom collection

2014-11-12 Thread John Huss
No. You can use java.util.List or Set or Map and that is all currently. I explored adding support a bit, but never finished anything. On Wed, Nov 12, 2014 at 5:14 PM, Lon Varscsak wrote: > Is there a way in the modeler to specify a custom collection class as my > to-many type? > > -Lon >

Re: Extracting tokens from an expression and matching an object against that expression without parsing twice

2014-11-14 Thread John Huss
This looks like a serious micro optimization. Is the performance for this really that critical? Have you demonstrated that this is your application's crucial hot spot? On Fri, Nov 14, 2014 at 7:35 AM, Davide Vecchi wrote: > Hi all, > > I have an expression in a string, and I use Cayenne to par

Re: DataObject accessor names - ditching the "get" prefix

2015-04-01 Thread John Huss
There are WO friendly templates for Cayenne in the ERCayenne framework in Project Wonder that you can copy. On Wed, Apr 1, 2015 at 7:18 AM Michael Gentry wrote: > This works with 3.0.2. I need to upgrade it for 3.1, but hopefully it'll > give you the general idea: > > https://github.com/mrg/cbe/

Re: DataObject accessor names - ditching the "get" prefix

2015-04-01 Thread John Huss
/www.loftfar.is/> > // s. 895-6688 > > > > > On 1. apr. 2015, at 14:03, John Huss wrote: > > > > There are WO friendly templates for Cayenne in the ERCayenne framework in > > Project Wonder that you can copy. > > On Wed, Apr 1, 2015 at 7:18 AM Michael Gent

Re: Custom DB Field Typ in Cayenne Modeler 3.1

2015-04-08 Thread John Huss
He's talking about the JDBC type. I don't think Java has a JDBC type for JSON currently, so yes, you have to modify the schema creation manually. On Wed, Apr 8, 2015 at 1:11 PM Michael Gentry wrote: > Hi André, > > Are you sure you can't add your custom type to Cayenne Modeler? On the > ObjEnt

Re: The "Datamap" class?

2015-05-12 Thread John Huss
Yes. The only thing it does currently is it will contain constants for the query names for any queries you define IN CayenneModeler. On Tue, May 12, 2015 at 12:51 PM Hugi Thordarson wrote: > Hi all, > > I’m curious—what is the purpose of the “Datamap” class generated by > Cayenne? I gave the do

Re: Prefetch nullifies relatinoship?

2015-05-13 Thread John Huss
It would be useful. MySQL disallows foreign keys that link different data types and that has caused problems for me when converting an app from Postgres to MySQL. A check like you propose would have caught it earlier. On Wed, May 13, 2015 at 10:27 AM Hugi Thordarson wrote: > Darn… Took a bette

Re: Trouble with Web deployment part 2

2015-06-13 Thread John Huss
Not sure if it changed but typically it goes directly in src so it is at the classpath root, and ends up in Web-inf/classes. On Sat, Jun 13, 2015 at 8:26 AM Andrew Willerding wrote: > Hi, > > I'm experiencing a new problem now with deploying a V4 Cayenne project. > With Version 3 projects I was a

Re: Cayenne and threading

2015-06-18 Thread John Huss
No, I don't think that's a good idea. The same context shouldn't be shared among threads. If you're doing pure SQL operations (like SQLTemplate) and not touching DataObjects you may be ok, but otherwise not. But yes, Executors are great, especially with lambdas. John On Thu, Jun 18, 2015 at 4:

Re: Cayenne and threading

2015-06-18 Thread John Huss
y writing OCR results to disk. Once OCR is > complete for all receipts, I read the text files back form disk and update > the DB. > > Optimally, I’d like to be able to update the objects (and save to the DB) > as I’m iterating through the receipt objects. Any ideas? > > Chee

Re: cayenne to hp vertica

2015-06-29 Thread John Huss
Yes, if it has a JDBC driver. On Mon, Jun 29, 2015 at 1:30 PM Tanneru, Raj wrote: > Hi, > > Can I connect to HP vertica data base from cayenne modeler? I just > downloaded apache cayenne 3.1 and don’t see an option for hp vertica. > > Thanks, > Raj Tanneru > > The information contained in this e

Re: 4.0 web.xml filter config files

2015-07-06 Thread John Huss
You can use subfolders inside WEB-INF/classes. These are essentially java packages, although it doesn't really matter. How you handle it would depend on your dev environment and build tool. With ant based projects, just throw in the src folder under whatever package you want, then ensure your an

Re: DBCP

2015-07-19 Thread John Huss
What were the errors? On Sun, Jul 19, 2015 at 5:37 PM Joe Baldwin wrote: > Is Cayenne 4.0 compatible with Apache commons-dbcp2 & commons-pool2? > > (While migrating to 4.0 (from 3.0), I was able to upgrade all of the other > commons libraries without errors, but these two caused errors. When I

Re: DataSourceInfo

2015-08-07 Thread John Huss
I think this is a "feature" of MySQL. It closes idle connections eventually. You can add a validationQuery to keep the connection active. On Fri, Aug 7, 2015 at 2:40 AM Joe Baldwin wrote: > Problem: I am having problems with MySQL connections being disabled > improperly on the production serve

Re: onPostAdd and nested object contexts

2015-09-01 Thread John Huss
Check for null for each property you are setting inside of onPostAdd(), like: public void onPostAdd() { if (getProperty() == null) { setProperty(defaultValue); } } On Tue, Sep 1, 2015 at 2:59 PM Lon Varscsak wrote: > I thought of that and tried it, but it's a new uninitialized o

Re: Query at the time of inserting data using Apache Cayenne

2015-09-12 Thread John Huss
You can just copy StatelessContextRequestHandler. It's small and simple. On Sat, Sep 12, 2015 at 7:48 AM Dipesh Jain wrote: > Thanks @Andrus for the help. I am using CayenneFilter session-scoped > context, > because of that I was having problem. I saw your solution but I am using > cayenne 3.1 an

Re: How do you update a record with apache cayenne without using select clause

2015-09-12 Thread John Huss
SqlTemplate allows you to define different queries for different databases and chooses the correct one at runtime. On Sat, Sep 12, 2015 at 7:51 AM Dipesh Jain wrote: > @Ari I do not want to write SQL query in SQL TEMPLETE or EJBQLQuery, > because I have two databases MS SQL server and PostgreSQ

Re: Is there a canonical method of invoking aggregate functions

2015-09-14 Thread John Huss
ERXKey is in cayenne 4.0 and is called Property and the default templates create them for you. On Mon, Sep 14, 2015 at 3:42 PM Joseph Senecal wrote: > > > > Can you give us a short summary of what features Wonder would bring to a > Cayenne developer? > > My favorite Project Wonder extension for E

Re: Fetching distinct related objects

2015-09-22 Thread John Huss
selectQuery.setDistinct(true); On Tue, Sep 22, 2015 at 9:37 AM Hugi Thordarson wrote: > Hi all, > > I’m trying to retrieve a list of distinct related objects. If I execute an > EJBQL-query that looks like this… > > "select distinct receipt.shop from Receipt receipt” > > …where “shop” is a relati

Re: Fetching distinct related objects

2015-09-22 Thread John Huss
alues of certain relationships. I haven’t found an > API for that in Cayenne, that’s why I’m using EJBQL. > > Then again, I might be on the wrong track… > > Thanks, > - hugi > > > > > On 22. sep. 2015, at 15:29, John Huss wrote: > > > > selectQuery.se

Re: Reading boolean values stored in a database as chars

2015-10-07 Thread John Huss
Check out the code for org.apache.cayenne.access.types.BooleanType and it's subclasses. I think you need to create your own extended type to handle it. Not sure if you can have multiple different BooleanTypes in the same runtime, but you could have one that detects and switches behavior dynamical

Re: using database generated PK

2015-12-02 Thread John Huss
The AUTO_PK_SUPPORT table exists only to support PK generation for DBs that do not have native support for it built in. However, in this day and age any database worth using has this built in. I've run production apps with Postgres, MySQL, FrontBase, and Interbase / Firebird, and all of them have

Re: using database generated PK

2015-12-03 Thread John Huss
The other reason for the auto_pk_support is that a custom db adaptor is needed to use native pks, and that isn't always immediately available. On Wed, Dec 2, 2015 at 9:08 PM John Huss wrote: > The AUTO_PK_SUPPORT table exists only to support PK generation for DBs > that do not

Re: Reuse of code. Global ServerRuntime?

2016-02-14 Thread John Huss
If you just need a context and not the runtime you can use: BaseContext.getThreadObjectContext(); as long as you bind one to the thread earlier. Or you can use the thread injector to get other stuff like an EntityResolver, or also a context, if you've bound it to a thread: public static ObjectCo

Re: Reuse of code. Global ServerRuntime?

2016-02-14 Thread John Huss
neRuntime.getThreadInjector().getInstance( ServerRuntime.class > ) return the currently operating ServerRuntime? > > - hugi > > > > > On 14. feb. 2016, at 13:50, John Huss wrote: > > > > If you just need a context and not the runtime you can use: > > > > Ba

Re: Reuse of code. Global ServerRuntime?

2016-02-14 Thread John Huss
> > > On 14. feb. 2016, at 14:16, John Huss wrote: > > > > It's your responsibility. > > > > You can't get the runtime that way, but you probably don't need to > (except > > for your existing code!). The injector has everything you'd

Re: Reconnecting automatically after DB downtime

2016-03-07 Thread John Huss
EOF can do JNDI, but that's not going to do anything to fix your problem. The connection pool in cayenne had some changes somewhat recently so it's entirely possible there are bugs. In practice it turns out many people don't use the connection pool built-in to Cayenne at all, and rather use a thi

Re: Reconnecting automatically after DB downtime

2016-03-07 Thread John Huss
rverRuntimeBuilder = serverRuntimeBuilder.dataSource( > dataSource > > >> ); > > >> > >>> > > >> > >>> Thanks, > > >> > >>> - hugi > > >> > >>> > > >> > >>> > > >>

Re: How to execute a stored procedure as part of a commitChanges?

2016-04-11 Thread John Huss
Try calling context.rollbackChanges() or just create a new context and start over. On Mon, Apr 11, 2016 at 10:31 AM Juan Manuel Diaz Lara wrote: > > > I am using 4.0.M3. > I used the following solution, but the problem is that after > commitChanges() the dataobjetcs are set to PersistenceState.C

Re: How to execute a stored procedure as part of a commitChanges?

2016-04-11 Thread John Huss
ll this is the idea, but I need more guide to do this, maybe not the > right classes to hack o derive, how to install my changes in a modular way, > etc., I am really new to cayenne. > Atte. Juan Manuel Díaz Lara > > On Monday, April 11, 2016 11:04 AM, John Huss > wrote:

Re: Does Cayenne 4.0.3M work on JellyBean 4.0?

2016-04-12 Thread John Huss
It doesn't work out if the box because Android is not a complete java implementation. The next version of Android will be though. It's possible to get it mostly working now but takes some effort. On Tue, Apr 12, 2016 at 6:48 AM Simon Farner wrote: > Hello everybody > > I built a working ORM setu

Re: Does Cayenne 4.0.3M work on JellyBean 4.0?

2016-04-14 Thread John Huss
Here is the Cayenne issue about Android support. You can follow those steps to get a working version. I only tried using ROP to access a remote server, but accessing a local database should work too. https://issues.apache.org/jira/browse/CAY-1604 John On Tue, Apr 12, 2016 at 7:16 AM Andrus Ada

Re: Reverse engineering and dates

2016-06-22 Thread John Huss
If this is a one-time task, just open up the cayenne-*.map.xml file in a text editor and do a Find and Replace All of "java.util.Date" with "org.joda.time.DateTime". On Wed, Jun 22, 2016 at 11:06 AM Tony Giaccone wrote: > When reverse engineering a database, the java.util.Date class is used in

QueryCache injection problem with multiple runtimes

2016-06-23 Thread John Huss
I'm starting to use QueryCache for the first time, and I'm using EhCache since OSCache is a dead product. My app creates two separate runtimes that are identical, but separate. If I configure both to use EhCache with the module: public class AppModule { public void configure(Binder binder) { bin

Re: Inserting records without querying the relations

2016-07-13 Thread John Huss
You can expose the fk directly as an attribute / property of the class and set it. Then if you don't need it going forward you can remove it and just use the relationship. On Wed, Jul 13, 2016 at 8:04 AM Harunobu Oyama wrote: > Hi, > > > Does Cayenne provide a way to insert records without queryi

Re: Aggregate function

2016-07-15 Thread John Huss
You need to call context.performQuery NOT performGenericQuery. On Fri, Jul 15, 2016 at 4:56 AM Harunobu Oyama wrote: > Hi, > > What is the Cayenne way to execute aggregate functions? > > For example, SELECT MAX("reading_id") FROM "reading" ? > > I tried passing SQLTemplate containing the SQL wri

Re: Aggregate function

2016-07-15 Thread John Huss
Make sure your sqltemplate us set to fetch datarows (hashmap) not objects On Fri, Jul 15, 2016 at 12:27 PM Harunobu Oyama wrote: > Michael, > > The min connection and max connection are both 1 as default. > > nobu > > > On 15 July 2016 at 18:16, Michael Gentry wrote: > > > On Fri, Jul 15, 2016 a

Re: Aggregate function

2016-07-15 Thread John Huss
LECT MAX(\"reading_id\") FROM > \"reading\" )" ); > List result = context.performQuery( query ); > > thank you, > nobu > > > > > On 15 July 2016 at 18:35, John Huss wrote: > > > Make sure your sqltemplate us set to fetch datarows (h

Re: Aggregate function

2016-07-15 Thread John Huss
You have to call query.setFetchesDataRows(true) On Fri, Jul 15, 2016 at 1:08 PM John Huss wrote: > That's the query you don't want. You want a DataRow object not a Reading. > On Fri, Jul 15, 2016 at 12:58 PM Harunobu Oyama wrote: > >> John, >> >> So, there

Re: auto PK generation in Cayenne 4 + PostgreSQL combination?

2016-07-28 Thread John Huss
By default cayenne expects the sequence to be incremented in blocks of 20, not by 1, so you have to specify that when you create the sequence. Using serial columns is very very small improvement and since support is still a ways off you would be much better off just creating your sequences and let

Re: auto PK generation in Cayenne 4 + PostgreSQL combination?

2016-07-28 Thread John Huss
> > On 28 July 2016 at 19:58, John Huss wrote: > > > By default cayenne expects the sequence to be incremented in blocks of > 20, > > not by 1, so you have to specify that when you create the sequence. > Using > > serial columns is very very small improvement and sinc

Re: Eomodeler to Cayenne

2016-08-10 Thread John Huss
java.lang.NoSuchMethodError: org.apache.commons.collections .IteratorUtils.singletonIterator(Ljava/lang/Object;)Lorg/ apache/commons/collections/ResettableIterator; This means that you have a version of the commons-collections jar in your classpath that is too old. There may be an old one and a n

Re: cayenne-crypto enhancements

2016-08-30 Thread John Huss
I've used for a new things and it has worked well once I figured out how to get it set up. Adding more documentation is the big need that I see. Other than that, I've been pleased. It has worked well and filled important needs immediately. On Tue, Aug 30, 2016 at 4:16 AM Andrus Adamchik wrote:

Re: ServerRuntime from ObjectContext

2016-09-06 Thread John Huss
Most apps only need a single ServerRuntime, not multiple. You can pass multiple DataDomains (models) to a single ServerRuntime constructor. The runtime itself isn't that similar to the OSC. It is really just a thing that configures the dependency injection and becomes the entry point to Cayenne.

Re: Monitoring long running queries

2016-09-09 Thread John Huss
You can set the property in the module when creating your ServerRuntime: new Module() { @Override public void configure(Binder binder) { MapBuilder props = binder.bindMap(Constants.PROPERTIES_MAP); props.put(Constants.JDBC_MAX_QUEUE_WAIT_TIME, 8000); // 8 seconds } } This only will report A

Re: Monitoring long running queries

2016-09-09 Thread John Huss
Also, this doesn't really work for SQLTemplate queries - it will print the log and the time taken, but the SQL is just "null". Not sure if it works for EJBQL queries. On Fri, Sep 9, 2016 at 9:06 AM John Huss wrote: > You can set the property in the module when creating

Re: Bamboo vs. Jenkins for Cayenne, other projects

2016-09-09 Thread John Huss
Personally I have never heard of Bamboo. I'm guessing we are still using Jenkins because change takes effort, and Jenkins works. On Fri, Sep 9, 2016 at 10:12 AM wrote: > Sorry for the slightly off-topic post, but the combined wisdom and > experience of this group is substantial. > > Cayenne is

Re: Monitoring long running queries

2016-09-13 Thread John Huss
e note, I am looking to having a JMX or metrics framework > integration in Cayenne to be able to gather statistics via in a centralized > place and let user code to consume it in any way they want). > > Andrus > > > > > > On Sep 9, 2016, at 10:06 AM, John Huss wrote

Re: Fetching a list of objects from a list of primary keys

2016-09-14 Thread John Huss
You can use ExpressionFactory.matchDbExp("pk1", val1).and(ExpressionFactory.matchDbExp("pk2", val2)) Then assemble the resulting AND expressions into a list of OR expressions using ExpressionFactory.or() pk1 = val1 AND pk2 = val2 OR pk1 = val3 AND pk2 = val4 OR pk1 = val5 AND pk2 = val6

Re: Compiling from source

2016-09-27 Thread John Huss
Without the entire build output I don't think anyone is going to be able to help you. On Tue, Sep 27, 2016 at 9:56 AM Lon Varscsak wrote: > No, I’m on a Mac (Sierra). If I compile with tests, the error above > doesn’t appear, but another error does (similar can’t resolve > dependencies). > > -L

Re: Batch Fetch

2016-10-05 Thread John Huss
Here is my implementation of this. There are a number of restrictions that limit the usefulness of this, but some could be removed with some rework. It's not full featured enough to add to core as is. Use at your own risk, no guarantees, etc. public static List batchFetch(Collection sourceObjec

Re: Batch iteration

2016-10-15 Thread John Huss
I would use a peer context. You can create a peer context like this if you runtime has been bound to the current thread using CayenneRuntime.bindThreadInjector(runtime.getInjector()) public static ObjectContext newObjectContext() { ObjectContextFactory factory = CayenneRuntime.getThreadInjector (

Re: Set DB Adapter in code

2016-10-18 Thread John Huss
Something like this? Collection nodes = runtime.getDataDomain().getDataNodes(); for (DataNode node : nodes) { node.setAdapter(myNewAdapter); } On Tue, Oct 18, 2016 at 11:27 AM Hugi Thordarson wrote: > Hi all, > when running tests I need to switch the DB adapter to H2Adapter (my > DataNode ha

Re: Set DB Adapter in code

2016-10-18 Thread John Huss
btain an > instance of an adapter? > > Cheers, > - hugi > > > > On 18. okt. 2016, at 16:56, John Huss wrote: > > > > Something like this? > > > > Collection nodes = runtime.getDataDomain().getDataNodes(); > > > > for (DataNode node : nodes) {

Re: Explicitly invalidating all cached objects in a ServerRuntime/ObjectContext

2016-10-26 Thread John Huss
Collection allNodes = context.getGraphManager().registeredNodes(); context.invalidateObjects(allNodes); On Wed, Oct 26, 2016 at 8:51 AM Hugi Thordarson wrote: > Hi all. > I’ve been fighting a little with caching in the past few days. Is there > any way for me to just tell Cayenne invalidate all

  1   2   3   >