Re: Reengineering Overwrites

2009-04-08 Thread John Armstrong
Under to Tools menu in the modeler you can select the 'Migrate Database Schema' command. This will diff the db against your current current map. You can then, per change, decide if you want to take the DB version, the Cayenne version or ignore. Its the best feature ever, I use it daily. This may

Re: Reengineering Overwrites

2009-04-08 Thread Robert Zeigler
Have you tried using the "migrate" functionality? Although the default directionality is from your model to the database, you can reverse the directionality and go from the database back to your model. I haven't played with this much so YMMV, but it's worth looking into. Robert On Apr 8,

RE: Reengineering Overwrites

2009-04-08 Thread Weddle, Anthony
Well, if I do reverse engineering in the modeler, the process wants to create new ObjEntity entries. For any table that I accept an overwrite for, it creates a new corresponding ObjEntity. I thought it might overwrite the old one but it creates a new one, with a unique suffix. This newly created Ob

Re: Reengineering Overwrites

2009-04-08 Thread Aristedes Maniatis
On 09/04/2009, at 1:18 PM, Weddle, Anthony wrote: We occasionally make database schema changes. We also modify some of the attributes of ObjEntity entries. It looks like a reverse engineering run would ignore any changes to ObjEntity entries. Is there any way to have changes merged? You

Reengineering Overwrites

2009-04-08 Thread Weddle, Anthony
We occasionally make database schema changes. We also modify some of the attributes of ObjEntity entries. It looks like a reverse engineering run would ignore any changes to ObjEntity entries. Is there any way to have changes merged? With Hibernate, we use middlegen to generate the classes, dir

RE: General queries

2009-04-08 Thread Weddle, Anthony
Well, it looks like EJBQL could be the way to go. It's not as powerful as HQL (or maybe it just doesn't have quite the same features) but it seems to do a lot of what we might need. It does have some issues though. This is part of one HQL query that we use in one report: select ios, (select nvl

Re: Lifecycle Design

2009-04-08 Thread Malcolm Edgar
Hi Joe, Your singleton cache is going to need to be update periodically if there are changes to the under lying database from other sources. regards Malcolm Edgar On Thu, Apr 9, 2009 at 7:45 AM, Joe Baldwin wrote: > I *think* this is a life-cycle question, but there may be more to it. > > Propo

Lifecycle Design

2009-04-08 Thread Joe Baldwin
I *think* this is a life-cycle question, but there may be more to it. Proposed Design: 1. Standard Web page JSP using Tomcat server. 2. One of the JSP's accesses a singleton. 3. The singleton accesses and stores a database field via Cayenne (presumably when the class is initially loaded) and s

Re: General queries

2009-04-08 Thread Andrus Adamchik
On Apr 8, 2009, at 10:27 PM, Weddle, Anthony wrote: One of the main problems I'm having is that there is so little documentation, books and articles about Cayenne. Is there a fairly comprehensive list of publications (not necessarily books) on Cayenne? Unfortunately no. Cayenne developer comm

Re: General queries

2009-04-08 Thread Robert Zeigler
Well, Cayenne doesn't "force" you to use SQL. What it /does/ do is to /allow/ you to use SQL. An app I wrote awhile back had the requirement to generate reports from tables with on the order of a million records. There was no substitute for hand crafted, carefully optimized queries. Cayenne m

RE: General queries

2009-04-08 Thread Weddle, Anthony
Thanks, Andrus. I'll take a look at EJBQL and may have to revisit SQLTemplates. It's not that the latter is scary, just that it appears to be native SQL, rather than being able to used property paths and class or object entity names. We're using an ORM framework to avoid native SQL wherever we can,

Re: Can't delete in Cayenne 3M5 :(

2009-04-08 Thread Joseph Schmidt
Hi, Thank you very much for the quick response. > The 3.0 API was relaxed from 2.0. In 2.0, deleteObject took > an org.apache.cayenne.Persistent.  In 3.0, it takes any > java.lang.Object. I see... > See: > http://cayenne.apache.org/doc/api/org/apache/cayenne/access/DataContext.html#deleteObje

Re: EJBQL and parameters

2009-04-08 Thread Robert Zeigler
Two thoughts. 1) You're not doing anything that /requires/ EJBQLQuery. So, if you're /really/ interested in using the cayenne-provided constants, switch to SelectQuery. SelectQuery q = new SelectQuery(UserSchedule.class);//<-- see? Type safety... :) Expression e = ExpressionFactory

Re: Can't delete in Cayenne 3M5 :(

2009-04-08 Thread Robert Zeigler
Well... I don't use Click, but I do use deleteObject all the time with no issues. It looks like you're running into an API difference. The 3.0 API was relaxed from 2.0. In 2.0, deleteObject took an org.apache.cayenne.Persistent. In 3.0, it takes any java.lang.Object. See: http://cayenne.a

Can't delete in Cayenne 3M5 :(

2009-04-08 Thread Joseph Schmidt
Trying to delete object entities with Cayenne 3M5 doesn't seem to work anymore - it used to work with 2.0 :(. I'm getting the error message: java.lang.NoSuchMethodError: org.apache.cayenne.access.DataContext.deleteObject(Lorg/apache/cayenne/Persistent;)V Is there something different in 3.0 abo

Re: EJBQL and parameters

2009-04-08 Thread Francois Eyl
oh, sorry it's my bad. I did a typing mistake I wanted to type : query.setParameter("SKDID", UserSchedule.SCHEDULE_ID_PROPERTY); Robert, you right, I'm trying to use paramters to specify Columns and so use available constants coming from Cayenne. This way, even if columns name change, nothing to c

Re: EJBQL and parameters

2009-04-08 Thread Robert Zeigler
Hm. I've never thought about specifying the columns and table via parameters. Event supposing that this works (not convinced it does/will), do you actually have a property named 1 in the UserSchedule entity (select us.:SKDID...setParameter("SKDID",1) => select us.1)? Try specifying the entity

Re: "Can't get primary key from temporary id" :(

2009-04-08 Thread Joseph Schmidt
> It sounds like you are trying to > write a record into a log/audit > table.  Yes, for some entities it is some sort of high level audit, and for others it is a recent activity table. > Have you looked at MySQL triggers to do > this?  The advantage > of using a trigger is that even if someone c

Re: "Can't get primary key from temporary id" :(

2009-04-08 Thread Michael Gentry
It sounds like you are trying to write a record into a log/audit table. Have you looked at MySQL triggers to do this? The advantage of using a trigger is that even if someone changes it outside of Cayenne (the mysql> prompt, etc) the audit table will still be populated. Much safer to do it this

EJBQL and parameters

2009-04-08 Thread Francois Eyl
Howdy guys, I'm trying to use EJBQL query and parameters, but I can't get it to work. Is there something special for ? Bellow is a quick sample of what I'm doing : String queryString = "SELECT us.:SKDID FROM :USCHED us WHERE us.:UID=1"; EJBQLQuery query = new EJBQL

Re: General queries

2009-04-08 Thread Malcolm Edgar
Hi Anthony, I think the feature you are after in Cayenne is Named Queries. In the CayenneModeler click on the "Create Query" icon, then in dialog "Select New Query Type" select the "Raw Query" option and then "Create" button. This will take you to a screen where you can define the query name and