In 4.1.RC2, how to contribute/replace PKGenerator

2020-01-27 Thread Juan Manuel Diaz Lara
My DB is postgres, how can I contribute/replace de PostgresPkGenerator with my own implementation to genera UUID's as PK's: public class PcExpressPosUUIDPkGenerator extends PostgresPkGenerator {     public PcExpressPosUUIDPkGenerator(@Inject PostgresAdapter adapter) {         super(adapter);     }

Fail migrating project from 4.0.B2 to 4.1.RC2

2020-01-27 Thread Juan Manuel Diaz Lara
I opened my project with Cayenne Modeler, and accept all. It fails to migrate correctly inter-datamap references... referecens in same datamap are ok. The skeleton for the inter-datamap relationships are shown with empty targets and details. Thanks for your great tool. Atte. Juan Manuel Díaz L

Re: Template path strip out home directory,

2020-01-20 Thread Juan Manuel Diaz Lara
t; template=${basedir}/cgen/subclass.vm" > > destDir="src" > > outputPattern="*.java" > > encoding="UTF-8" > > mode="all" > > /> > > > > On Fri, Jan 17, 2020 at 6:47 PM Juan Manuel Diaz Lara > wrote

Re: How to access DataChannelMetaData from templates

2020-01-20 Thread Juan Manuel Diaz Lara
templates, as it's not that configurable as server runtime. We have a task for that [1], but no estimate though. [1] https://issues.apache.org/jira/browse/CAY-2338 On Fri, Jan 17, 2020 at 9:39 PM Juan Manuel Diaz Lara wrote: > > This is to be get the "comment" of the mapping node

Template path strip out home directory,

2020-01-17 Thread Juan Manuel Diaz Lara
I am using Cayenn 4.1.RC and trying to user custom templates. I created a new template, an selected in preferences, when generating I choose Advance and selecte my new template, generations fails with "Unable to find resource ..." and the template path, but this path does not have my home direct

How to access DataChannelMetaData from templates

2020-01-17 Thread Juan Manuel Diaz Lara
This is to be get the "comment" of the mapping node of attributes to generate additional features to _baseClasses. I really need then at run time but I will be happy if I can get it at generation time. Thanks. Atte. Juan Manuel Díaz Lara

How to use pluggable handlers

2020-01-15 Thread Juan Manuel Diaz Lara
I would like to add metadata and use it at runtime to generate automatic UI to edit entities...  metadata like column title, label, java validation tags, etc. My first thought to use then comments on cayenne 4.1 but I did not was able to navigate from objAttribute to the comment added en the sche

How to use obtAtrribute comments in cgen's templates ?

2019-04-30 Thread Juan Manuel Diaz Lara
I would like to enhance code generation with some Hibernate Validation Annotations written as comments on the modeller. Thanks for your help. Atte. Juan Manuel Díaz Lara

How to integrate a stored procedure call with commitChanges or cayenne transaction ?

2018-05-06 Thread Juan Manuel Diaz Lara
The purpose is to use db stored procedures to do the post-processing of my object graph, something like (seudo-code); start cayenne transaction cayenne commitChanges(); call stored procedure/function to post-process (heavy process). commit cayenne transaction I would be nice that if st

About Improved Transaction API on 4.0

2018-03-20 Thread Juan Manuel Diaz Lara
runtime.performInTransaction(() -> { // ... do some changes context.commitChanges(); // ... do more changes context.commitChanges(); return true; }); Previous code is an example on "Guide to 4.0 Features". My questions are: - What is then persis

How to properly replace DataDomain....

2018-03-06 Thread Juan Manuel Diaz Lara
I am using  4.0.M5. The next code used to work in a previous version, but now PCADataDomainProvider is never called to create my custom DataDomain: public class ServerModuleWithPostCommitActions implements org.apache.cayenne.di.Module {     @Override     public void configure(Binder binder) {  

Re: How to call a procedure as part of commitChanges ?

2018-03-06 Thread Juan Manuel Diaz Lara
Díaz Lara On Tuesday, March 6, 2018, 9:46:30 AM CST, Maik Musall wrote: Hi Juan, couldn't you do this more easily and reliably with a db trigger? Maik > Am 06.03.2018 um 16:11 schrieb Juan Manuel Diaz Lara > : > > Is there any way to call a stored procedure as

How to call a procedure as part of commitChanges ?

2018-03-06 Thread Juan Manuel Diaz Lara
Is there any way to call a stored procedure as part of commitChanges ? I would like to call a stored procedure after flushing my persistent objects but before the real db commit, for instance, to make some process on the db as part of committing my objects, but transactionally. performInTransac

Re: How to install my own DbAdapterDetector on 4.0.B2

2018-02-12 Thread Juan Manuel Diaz Lara
Lara On Monday, February 12, 2018, 7:06:42 PM CST, Juan Manuel Diaz Lara wrote: My code was working on 4.0.M5, but I ca not figure out how to make it work on B2, I think the problem is that I am not installing my DbAdapterDetector properly. package com.ace.dba; import s

How to install my own DbAdapterDetector on 4.0.B2

2018-02-12 Thread Juan Manuel Diaz Lara
My code was working on 4.0.M5, but I ca not figure out how to make it work on B2, I think the problem is that I am not installing my DbAdapterDetector properly. package com.ace.dba; import static org.apache.cayenne.configuration.Constants.SERVER_ADAPTER_DETECTORS_LIST; import org.apache.cayen

Re: Problem using to-many relationship on where clause

2017-11-29 Thread Juan Manuel Diaz Lara
a note here too. Looks like a bug to me too. Will investigate and file a bug (and ideally make a fix) if required. On Wed, Nov 29, 2017 at 9:17 AM, Juan Manuel Diaz Lara wrote: > I created a new project, with entities Products -toMany-> > StockcurrentCorporativo, with same results.

Re: Problem using to-many relationship on where clause

2017-11-28 Thread Juan Manuel Diaz Lara
. Juan Manuel Díaz Lara On Tuesday, November 28, 2017, 2:04:43 PM CST, Juan Manuel Diaz Lara wrote: I am agree that this kind of query should generate a SQL DISTINCT, but the fact is that adding a joint()brings only one product on result even the sql generates 16 rows, so Cayenne is

Re: Problem using to-many relationship on where clause

2017-11-28 Thread Juan Manuel Diaz Lara
generates a "distinct" in the query.  I'm not sure why it would be different for you. -Lon On Mon, Nov 27, 2017 at 8:45 PM, Juan Manuel Diaz Lara < jmdia...@yahoo.com.invalid> wrote: > More details, this code should return only one product entity, but > produces a r

Re: Problem using to-many relationship on where clause

2017-11-27 Thread Juan Manuel Diaz Lara
ze of relationships ?. Please help. Atte. Juan Manuel Díaz Lara On Sunday, November 26, 2017, 8:57:50 PM CST, Juan Manuel Diaz Lara wrote: I am using 4.0.M5, previously this query worked as I expected: ObjectSelect q = ObjectSelect.query(Product.class)                  .whe

Problem using to-many relationship on where clause

2017-11-26 Thread Juan Manuel Diaz Lara
I am using 4.0.M5, previously this query worked as I expected: ObjectSelect q = ObjectSelect.query(Product.class)                  .where(Product.EXISTENCIAS_CORPORATIVAS.dot(StockCurrentCorporativo.UNITS).gt(0.0))     .and(Product.CODE.like("USBVGA");    

Re: Cayenne-Tapestry integration problem

2017-10-13 Thread Juan Manuel Diaz Lara
Thanks, that was the correct answer. I had no seen thar property before because my app was client-server. Atte. Juan Manuel Díaz Lara On Thursday, October 12, 2017, 3:17:47 PM CDT, Juan Manuel Diaz Lara wrote: Yes!!! I will try whitout it and report result.  Thanks. Atte. Juan

Re: Cayenne-Tapestry integration problem

2017-10-12 Thread Juan Manuel Diaz Lara
Yes!!! I will try whitout it and report result.  Thanks. Atte. Juan Manuel Díaz Lara On Thursday, October 12, 2017, 1:14:30 PM CDT, Juan Manuel Diaz Lara wrote: I devoloped a module to integrate cayenne into apache-tapestry, using cayenne 4.0.M5 and tapestry 5.4.3... I the module I

Cayenne-Tapestry integration problem

2017-10-12 Thread Juan Manuel Diaz Lara
I devoloped a module to integrate cayenne into apache-tapestry, using cayenne 4.0.M5 and tapestry 5.4.3... I the module I create a single ServerRuntime for mi web app, then, on each request I call serverRuntime.newContext(); to get a new fresh ObjectContext, but some way I get the same results i

ProcedureCall not failing when ommiting parameter

2017-03-27 Thread Juan Manuel Diaz Lara
I found that If you map a procedure and you pass a wrong parameter name on ProcedureCall, Cayenne does not throw an exception, it just pass null to db for the missing parameters. This could be a bug or enhancement, but I do not know where to put this comment, hope someone knows. Atte. Juan Manu

Re: How does optimistic locking works ?

2016-04-29 Thread Juan Manuel Diaz Lara
ow what has changed instead, which is an entirely different discussion. mrg On Thu, Apr 28, 2016 at 10:31 PM, Juan Manuel Diaz Lara < jmdia...@yahoo.com.invalid> wrote: > Ok, I was thinking on other frameworks... the simple solution is to > increment the version field from the app bef

Re: How does optimistic locking works ?

2016-04-28 Thread Juan Manuel Diaz Lara
it and ensure a monotonically increment. To anyone maybe interested.  Atte. Juan Manuel Díaz Lara On Thursday, April 28, 2016 5:52 PM, Juan Manuel Diaz Lara wrote: I have this simplified scenario where the second commitChanges fails with an optimistic exception: s

How does optimistic locking works ?

2016-04-28 Thread Juan Manuel Diaz Lara
I have this simplified scenario where the second commitChanges fails with an optimistic exception: s = CayenneDao.instance.getByPrimaryKey(StockCurrent.class, testStockcurrentId);         s.setUnits(s.getUnits()+1));     context.commitChanges();                   s.setUnits(s.ge

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

2016-04-18 Thread Juan Manuel Diaz Lara
Actually, I am reviewing the code to hack it, I append a sequence diagram of my analysis, hotspotting in red the points where cayenne  do some actions that must be done post transaction commit but are actually done before transaction commits.  The sequence diagram shows the scenario where we are

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

2016-04-12 Thread Juan Manuel Diaz Lara
Jurgen, your code is great for one dataobject, but how to do it for the entire context automatically ?  Atte. Juan Manuel Díaz Lara On Tuesday, April 12, 2016 2:04 PM, Juan Manuel Diaz Lara wrote: Thanks, I will try it this later, report results.  Atte. Juan Manuel Díaz Lara     On

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

2016-04-12 Thread Juan Manuel Diaz Lara
f( changes ); Then you should be back to where you started before the attempted commit. Regards Jurgen -Original Message----- From: Juan Manuel Diaz Lara Sent: Tuesday, April 12, 2016 4:59 AM To: user@cayenne.apache.org Subject: Re: How to execute a stored procedure as part of a commitCha

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

2016-04-11 Thread Juan Manuel Diaz Lara
, 2016 3:21 PM, John Huss wrote: I think changing Cayenne is the wrong solution here. The problem is that your commit failed. You have to rollback the context if you want to keep using it. On Mon, Apr 11, 2016 at 2:22 PM Juan Manuel Diaz Lara wrote: > Calling rollbackChanges will lost

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

2016-04-11 Thread Juan Manuel Diaz Lara
() 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.COMMITED, if > the stor

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

2016-04-11 Thread Juan Manuel Diaz Lara
s://cayenne.apache.org/docs/4.0/cayenne-guide/persistent-objects-objectcontext.html#transactions On Mon, Apr 11, 2016 at 10:54 AM, Juan Manuel Diaz Lara wrote: > > >  I have a dataobjet graph with some changes, and a db stored procedure that >should run after this changes are in the d

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

2016-04-11 Thread Juan Manuel Diaz Lara
I have a dataobjet graph with some changes, and a db stored procedure that should run after this changes are in the db, but must run in the same transaction because it make some more changes to other data, this changes can fail so I want the commitChanges fail if the stored procedure fails.

NullPointerException in addToManyTarget and removeToManyTarget

2016-04-08 Thread Juan Manuel Diaz Lara
I am using Cayenne 4.0.M3. I want to build an graph of persistent objects  using the api for many targets, but I get the following trace: Exception in thread "main" java.lang.NullPointerException     at org.apache.cayenne.CayenneDataObject.addToManyTarget(CayenneDataObject.java:248)     at com.a

Fw: Null pointer exception in addToManyTarget and removeToManyTarget

2016-04-08 Thread Juan Manuel Diaz Lara
 Atte. Juan Manuel Díaz Lara On Friday, April 8, 2016 6:27 PM, Juan Manuel Diaz Lara wrote: I am using Cayenne 4.0.M3. I want to build an graph of persistent objects  using the api for many targets, but I get the following trace: Exception in thread "

Null pointer exception in addToManyTarget and removeToManyTarget

2016-04-08 Thread Juan Manuel Diaz Lara
I am using Cayenne 4.0.M3. I want to build an graph of persistent objects  using the api for many targets, but I get the following trace: Exception in thread "main" java.lang.NullPointerException     at org.apache.cayenne.CayenneDataObject.addToManyTarget(CayenneDataObject.java:248)     at com.a