You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Michael Gentry <mg...@masslight.net> on 2009/09/09 16:29:02 UTC

JNDI Anomaly

This is the first time I'm trying to use JNDI with Cayenne (also with
T5 and Eclipse).  I followed the steps on:

http://cayenne.apache.org/doc/using-jndi.html

for using Cayenne with the user preference DB to simulate a JNDI for
development purposes.  Since I'm using Maven, I added the Modeler jars
to the POM, which worked fine.  Now when I run the application I get a
new generic Java application icon in my dock that stays there until I
shutdown the web application.  It doesn't seem hurt anything, but is a
little strange.  Something about adding the Modeler jar to the project
and then running causes an application icon to appear in the dock that
didn't before.  Has anyone else seen this?

Thanks,

mrg

Re: JNDI Anomaly

Posted by Michael Gentry <mg...@masslight.net>.
It seems less a hack and more of a feature.  :-)

I figured the icon appearing was because some UI stuff was being
called, but I have no idea why it would get called to read the
preferences DB.  The only thing I added to the project is the Modeler
jar.  Perhaps something in the JNDI feature makes a GUI call?  (I
haven't dug into the source to see.)

As long as it doesn't get activated on the server during the
deployment ... probably OK.  I know why that code is in the Modeler,
but it also seems a bit awkward to include the Modeler to deploy
server-side, too.

mrg


On Wed, Sep 9, 2009 at 10:46 AM, Andrus Adamchik<an...@objectstyle.org> wrote:
> The icon means some Swing/AWT/Java2D stuff got activated. I am using the
> JNDI hack extensively on Mac and by itself it never causes it, but any
> unrelated image processing code would cause it.
>
> Andrus
>
> On Sep 9, 2009, at 10:29 AM, Michael Gentry wrote:
>
>> This is the first time I'm trying to use JNDI with Cayenne (also with
>> T5 and Eclipse).  I followed the steps on:
>>
>> http://cayenne.apache.org/doc/using-jndi.html
>>
>> for using Cayenne with the user preference DB to simulate a JNDI for
>> development purposes.  Since I'm using Maven, I added the Modeler jars
>> to the POM, which worked fine.  Now when I run the application I get a
>> new generic Java application icon in my dock that stays there until I
>> shutdown the web application.  It doesn't seem hurt anything, but is a
>> little strange.  Something about adding the Modeler jar to the project
>> and then running causes an application icon to appear in the dock that
>> didn't before.  Has anyone else seen this?
>>
>> Thanks,
>>
>> mrg
>>
>
>

Re: Id problem when trying to make a component decoupling a module

Posted by Aristedes Maniatis <ar...@maniatis.org>.
On 5/10/09 3:31 PM, hans@welinux.cl wrote:
> The problem is when we try to set the id in a class using the workflow it gives me the aforementioned message of temporary id. I don't want to commit in the middle like i did before in order to get the id, or to try to manually keep the keys of the workflow with a custom sequence or something, or to update the id after commit.

You'll need to write your library so that it deals with Java objects which have no knowledge of how they are to be persisted in a database. Once you write code which operates on primary keys, you'll either need to persist the objects in a database already or start using UUIDs. Either way is a step away from the promise of an ORM: to abstract the realities of database storage from the objects your code deals with.

As far as your URL problem is concerned, you are pretty much sunk if your application has to be sessionless. Which is why any application which begins to have a sophisticated workflow will need to keep objects server-side within a session. Then you have no requirement to create URLs which embed primary keys.

In short, you are finding it hard to create and manage primary keys in your component mainly because it is the wrong approach for code like this.

Ari Maniatis


-- 

-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

Id problem when trying to make a component decoupling a module

Posted by ha...@welinux.cl.
Hi,

I've crashed again with the infamous message Can't get primary key from temporary id.

This has happened me constantly in the area of reusing code.

Some weeks ago, i needed to create an objet and then send its id in the url to a web control responsible to filling it. I was forced to commit between the transaction to obtain the id. The process was simple and we were able to live with it.

Now we are forcing something more complex: our company developped a very complex software and in the process we developed a very robust workflow engine to support it.
We decided to decouple the workflow component from the application where it was born. The idea is to make a jar file for using in other projects, and not resort to copy paste.

As you can see, the extraction means decoupling the workflow and associated classes from the rest of the classes of the system.

In order for workflow classes not to depend on any particular class, it was necessary to remove the relationships in cayenne and try to make a soft bind with cayenne using the id of the related workflow in the classes that wich to use it.

The problem is when we try to set the id in a class using the workflow it gives me the aforementioned message of temporary id. I don't want to commit in the middle like i did before in order to get the id, or to try to manually keep the keys of the workflow with a custom sequence or something, or to update the id after commit.

Note: Sharing of the map was very easy and worked fine.

Any help will be appreciated.

Thanks
Hans

Re: Model Refactor, move table from one Map to Another

Posted by ha...@welinux.cl.
Aristides,

Thank you. Actually i resolved it with a mix of all the advices, i made a copy of the schema for surgery, the removed all the unnecesary tables using the modeler, then fixed each relation one by one...

Hans

----- "Aristedes Maniatis" <ar...@maniatis.org> escribió:

> On 2/10/09 7:24 AM, Evgeny Ryabitskiy wrote:
> > As an instant solution I can advise you to open "*.map.xml" for
> your
> > both maps and copy-paste everything connected to your Table from
> one
> > xml file to another.
> 
> And if you use a tool which validates XML against a schema (eg Oxygen)
> then you can be fairly sure it will still work once you have edited it
> by hand.
> 
> Ari
> 
> -- 
> 
> -------------------------->
> Aristedes Maniatis
> GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

-- 
Hans Poo, WeLinux S.A. http://www.welinux.cl
Oficina: 697.25.42, Celular: 09-319.93.05
Bombero Ossa # 1010, Santiago


Re: Model Refactor, move table from one Map to Another

Posted by Aristedes Maniatis <ar...@maniatis.org>.
On 2/10/09 7:24 AM, Evgeny Ryabitskiy wrote:
> As an instant solution I can advise you to open "*.map.xml" for your
> both maps and copy-paste everything connected to your Table from one
> xml file to another.

And if you use a tool which validates XML against a schema (eg Oxygen) then you can be fairly sure it will still work once you have edited it by hand.

Ari

-- 

-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

Re: Model Refactor, move table from one Map to Another

Posted by ha...@welinux.cl.
Evgeny,

I'll give it a try, just being too lazy...

Thanks
Hans

----- "Evgeny Ryabitskiy" <ev...@gmail.com> escribió:

> 2009/10/2  <ha...@welinux.cl>:
> > Hi List,
> >
> > In order to reuse some logic i'm trying to refactor an old model and
> i was wondering if there is a way to move a Table and its associated
> Entity from one map to another, i'm using just one domain.
> >
> > I tried in the last 3.0M6 modeler, the cut & paste looks very nice,
> i was crossing my fingers, but after the move, all the object and db
> relationships gets broken, the tables i'm trying to refactor have lots
> of relationships. May be somebody has writen some script or knows of
> some guide for doing this ?
> >
> > Thanks
> > Hans
> >
> 
> Hello!
> 
> As an instant solution I can advise you to open "*.map.xml" for your
> both maps and copy-paste everything connected to your Table from one
> xml file to another. It's common XML, I's not so hard, believe me.
> If you wish to do it in more automatic way, write your XML-parser
> that
> is looking for all Table relations and coping them. Also not so hard.
> After it you can contribute you Table-Transporter to Cayenne modeler
> as a refactor extension ;)
> 
> Still a chance that some one else from List share with you such
> tool....
> 
> Best regards,
>  Evgeny Ryabitskiy.

-- 
Hans Poo, WeLinux S.A. http://www.welinux.cl
Oficina: 697.25.42, Celular: 09-319.93.05
Bombero Ossa # 1010, Santiago


Re: Model Refactor, move table from one Map to Another

Posted by Evgeny Ryabitskiy <ev...@gmail.com>.
2009/10/2  <ha...@welinux.cl>:
> Hi List,
>
> In order to reuse some logic i'm trying to refactor an old model and i was wondering if there is a way to move a Table and its associated Entity from one map to another, i'm using just one domain.
>
> I tried in the last 3.0M6 modeler, the cut & paste looks very nice, i was crossing my fingers, but after the move, all the object and db relationships gets broken, the tables i'm trying to refactor have lots of relationships. May be somebody has writen some script or knows of some guide for doing this ?
>
> Thanks
> Hans
>

Hello!

As an instant solution I can advise you to open "*.map.xml" for your
both maps and copy-paste everything connected to your Table from one
xml file to another. It's common XML, I's not so hard, believe me.
If you wish to do it in more automatic way, write your XML-parser that
is looking for all Table relations and coping them. Also not so hard.
After it you can contribute you Table-Transporter to Cayenne modeler
as a refactor extension ;)

Still a chance that some one else from List share with you such tool....

Best regards,
 Evgeny Ryabitskiy.

Re: Model Refactor, move table from one Map to Another

Posted by Mike Kienenberger <mk...@gmail.com>.
You can always edit the xml file by hand.
Depending on what you're doing, that sometimes is easier for really
complicated operations.

If I wanted to preserve a table and just the relationships to other
specific tables I knew were going to be in a destination map, I'd
probably delete everything but the tables containing the relationships
I wanted using the modeler, then I'd manually go into the xml file and
remove the tables (but not the relationships) I didn't want, then I'd
copy what remained into the new map's xml file.

On Thu, Oct 1, 2009 at 5:06 PM,  <ha...@welinux.cl> wrote:
> Hi List,
>
> In order to reuse some logic i'm trying to refactor an old model and i was wondering if there is a way to move a Table and its associated Entity from one map to another, i'm using just one domain.
>
> I tried in the last 3.0M6 modeler, the cut & paste looks very nice, i was crossing my fingers, but after the move, all the object and db relationships gets broken, the tables i'm trying to refactor have lots of relationships. May be somebody has writen some script or knows of some guide for doing this ?
>
> Thanks
> Hans
>

Model Refactor, move table from one Map to Another

Posted by ha...@welinux.cl.
Hi List,

In order to reuse some logic i'm trying to refactor an old model and i was wondering if there is a way to move a Table and its associated Entity from one map to another, i'm using just one domain.
 
I tried in the last 3.0M6 modeler, the cut & paste looks very nice, i was crossing my fingers, but after the move, all the object and db relationships gets broken, the tables i'm trying to refactor have lots of relationships. May be somebody has writen some script or knows of some guide for doing this ?

Thanks
Hans

Re: JNDI Anomaly

Posted by Andrus Adamchik <an...@objectstyle.org>.
The icon means some Swing/AWT/Java2D stuff got activated. I am using  
the JNDI hack extensively on Mac and by itself it never causes it, but  
any unrelated image processing code would cause it.

Andrus

On Sep 9, 2009, at 10:29 AM, Michael Gentry wrote:

> This is the first time I'm trying to use JNDI with Cayenne (also with
> T5 and Eclipse).  I followed the steps on:
>
> http://cayenne.apache.org/doc/using-jndi.html
>
> for using Cayenne with the user preference DB to simulate a JNDI for
> development purposes.  Since I'm using Maven, I added the Modeler jars
> to the POM, which worked fine.  Now when I run the application I get a
> new generic Java application icon in my dock that stays there until I
> shutdown the web application.  It doesn't seem hurt anything, but is a
> little strange.  Something about adding the Modeler jar to the project
> and then running causes an application icon to appear in the dock that
> didn't before.  Has anyone else seen this?
>
> Thanks,
>
> mrg
>