sastan | 2 May 2005 10:25

Re: How to use Enums

> Here is an enums example by Michael Gentry:
> 
> http://objectstyle.org/confluence/display/CAY/Enumerations+Example
> 

Thx, that is exactly what i searched.

sastan

Jiki Seirei | 2 May 2005 19:55
Favicon

Putting cayenne.xml in a package

Hello,

Cayenne is working fine for me, but yesterday, I begun to comment, clean 
and arrange my code.

Before, cayenne was directly in my app .jar in the resources folder. Now 
it is located in a package like:

com.goyman.Ino.resources.cayenne

As this project will merge with bigger ones, my files needs to be 
perfectly aranged.

All the app is a tapestry project.

So can I set the cayenne.configuration.path parameter to something that 
will help?

Regards

Kuon

Jiki Seirei | 2 May 2005 20:01
Favicon

Re: Putting cayenne.xml in a package

Nevermind,

I went 10 times on the page where the answer was without seeing it.
(http://www.objectstyle.org/cayenne/userguide/deploy/custom.html)
URL for reference.

I'm sorry.

Regards

Kuon

Jiki Seirei wrote:

> Hello,
>
> Cayenne is working fine for me, but yesterday, I begun to comment, 
> clean and arrange my code.
>
> Before, cayenne was directly in my app .jar in the resources folder. 
> Now it is located in a package like:
>
> com.goyman.Ino.resources.cayenne
>
> As this project will merge with bigger ones, my files needs to be 
> perfectly aranged.
>
> All the app is a tapestry project.
>
> So can I set the cayenne.configuration.path parameter to something 
(Continue reading)

Zvonimir Spajic | 2 May 2005 15:06
Picon

error building Expressions: Can't resolve path component

Hello,

1) why it's not allowed to build an expression like this
   --> see qual_2 (error message: "Can't resolve path component:  
[Category.id]")

...
Expression qual_1 = Expression.fromString(SomeObject.NAME_PROPERTY + "  
likeIgnoreCase '%" + name + "%'");
Expression qual_2 = ExpressionFactory.matchExp("hasCategory.id",  
categoryId);
qual_1 = qual_1.andExp(qual_2);
SelectQuery query = new SelectQuery(SomeObject.class, qual_1);
...

-id is the PK-Column of category table

2) what is the best solution in this cases.

Thanks for help
Zvonimir Spajic

Zvonimir Spajic | 2 May 2005 15:21
Picon

Re: error building Expressions: Can't resolve path component

I tried something out, and is
this the best solution?

Without defining the id in the path (hasCategory.id), only write  
hasCategory:

...
Expression qual_2 = ExpressionFactory.matchExp("hasCategory", categoryId);
...

Greets
Zvonimir

On Mon, 02 May 2005 15:06:38 +0200, Zvonimir Spajic <z.spajic <at> ascensys.de>  
wrote:

> Hello,
>
> 1) why it's not allowed to build an expression like this
>    --> see qual_2 (error message: "Can't resolve path component:  
> [Category.id]")
>
> ...
> Expression qual_1 = Expression.fromString(SomeObject.NAME_PROPERTY + "  
> likeIgnoreCase '%" + name + "%'");
> Expression qual_2 = ExpressionFactory.matchExp("hasCategory.id",  
> categoryId);
> qual_1 = qual_1.andExp(qual_2);
> SelectQuery query = new SelectQuery(SomeObject.class, qual_1);
> ...
(Continue reading)

Andrus Adamchik | 2 May 2005 15:29
Favicon

Re: error building Expressions: Can't resolve path component

Hi Zvonimir,

The cleanest way is probably to use a Category object as a match parameter:

   Category catgeory = // ... obtain this object instead of usig id
   Expression e = ExpressionFactory.matchExp("hasCategory", category);

However if you want to match on an id, you should use "DB" flavor of
expressions. E.g.:

   Expression e = ExpressionFactory.matchDbExp("hasCategory.id", categoryId);

BTW, if you use Expression.fromString, Cayenne is using "db:" prefix to
distinguish between object and database path (e.g: "db:hasCategory.id").

Hope this helps.

Andrus

> I tried something out, and is
> this the best solution?
>
> Without defining the id in the path (hasCategory.id), only write
> hasCategory:
>
> ...
> Expression qual_2 = ExpressionFactory.matchExp("hasCategory",
> categoryId); ...
>
> Greets
(Continue reading)

paolog | 2 May 2005 15:30
Picon
Favicon

question-DataView(CellEditors)

Hello!
I have a question related to DataViews. When i render table using DataViews I 
want to display combo for interested column, (I have created a lookup field 
in data view modeler).

The code in user documentation is:

DOTableModel tableModel = new DOTableModel();
tableModel.setView(featureView);

// Retrieve a list of data objects (with SelectQuery, say)
// and initialize the model with it
DataObjectList featureDataObjects = ...;
tableModel.setDataObjects(matrixEntries);

featureTable.setModel(tableModel);

// set the apropriate TableCellRenderers and Editors
new CellRenderers().installRenderers(featureTable);
new CellEditors().installEditors(featureTable);

But combo in the appropriate column return only a empty list.

this return the correct lookupfield:
ObjEntityViewField fld = objectEntityView.getField(2).getLookupField();

and this return empty:
Object[] vlr = objectEntityView.getField(2).getLookupValues();

Where is my error ?
(Continue reading)

Cris Daniluk | 2 May 2005 15:35

RE: error building Expressions: Can't resolve path component

Zvonimir,

If you only have the category id and not the actual Category object, I
personally like to retrieve the object separately using DataObjectUtils
(pragmatically, you need to use the pk from time to time, but the less time
you spend internally communicating with pks, the better). This lets you use
the method Andrus recommended. It might be an extra step, but it pays
dividends in terms of clean code. On top of that, it may not even trigger a
db lookup!

An example:

Category category = (Category) DataObjectUtils.objectForPk(context,
Category.class, categoryId);

Hope that helps,

Cris

> Hi Zvonimir,
> 
> The cleanest way is probably to use a Category object as a 
> match parameter:
> 
>    Category catgeory = // ... obtain this object instead of usig id
>    Expression e = ExpressionFactory.matchExp("hasCategory", category);
> 
> However if you want to match on an id, you should use "DB" flavor of
> expressions. E.g.:
> 
(Continue reading)

Zvonimir Spajic | 2 May 2005 17:00
Picon

Re: error building Expressions: Can't resolve path component

thank you Cris,
thank you Andrus,

it helps.

Zvonimir

On Mon, 2 May 2005 09:35:07 -0400, Cris Daniluk  
<cris.daniluk <at> claraview.com> wrote:

> Zvonimir,
>
> If you only have the category id and not the actual Category object, I
> personally like to retrieve the object separately using DataObjectUtils
> (pragmatically, you need to use the pk from time to time, but the less  
> time
> you spend internally communicating with pks, the better). This lets you  
> use
> the method Andrus recommended. It might be an extra step, but it pays
> dividends in terms of clean code. On top of that, it may not even  
> trigger a
> db lookup!
>
> An example:
>
> Category category = (Category) DataObjectUtils.objectForPk(context,
> Category.class, categoryId);
>
> Hope that helps,
>
(Continue reading)

Sami Mohammed | 2 May 2005 17:06

SQLException

Hi all,

I am getting the following error, when i test on WSAD 5.1 its work fine, when i deployed same EAR file on
Weblogic 8.1 with the same oracle drive and same configuration. 
i am getting error in weblogic server see below.

java.sql.SQLException: Closed Connection at
oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134) at
oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179) at
oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269) at
oracle.jdbc.driver.OracleConnection.privatePrepareStatement(OracleConnection.java:945) at
oracle.jdbc.driver.OracleConnection.prepareStatement(OracleConnection.java:852) at
weblogic.jdbc.common.internal..ConnectionEnv.makeStatement(ConnectionEnv.java:1022) at
weblogic.jdbc.common.internal.ConnectionEnv.getCachedStatement(ConnectionEnv.java:855) at
weblogic.jdbc.common.internal.ConnectionEnv.getCachedStatement(ConnectionEnv.java:794) at
weblogic.jdbc.wrapper.Connection.prepareStatement(Connection..java:327) at
org.objectstyle.cayenne.dba.oracle.OracleSelectTranslator.createStatement(OracleSelectTranslator.java:132)
at org.objectstyle.cayenne.access.DataNode.runSelect(DataNode.java:385) at
org.objectstyle.cayenne.access.DataNode.performQueries(DataNode.java:350) at
org.objectstyle.cayenne.access.DataDomain.performQueries(DataDomain.java:654) at
org.objectstyle.cayenne.access.DataContext.performQueries(DataContext.java:1373) at
org.objectstyle.cayenne.access.Transaction.performQueries(Transaction.java:179) at
org.objectstyle.cayenne.access.DataContext.performQueries(DataContext.java:1331) at
org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:1587) at
org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:1450) at
com.independenthealth.edwdma.admin.actions.LoginAction.execute(LoginAction.java:74) at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) at
org.apache.struts..action.ActionServlet.process(ActionServlet.java:1482) at
org.apache.struts..action.ActionServlet.doPost(ActionServlet.java:525) at
(Continue reading)


Gmane