Erdinc | 1 Mar 2011 15:15
Picon
Favicon

java.lang.NoSuchMethodError: org.apache.cayenne.access.QueryLogger.setLogger(Lorg/apache/cayenne/log/JdbcEventLogger;)V

Hi,
I just downloaded v 3.1M1. When I try to create ServerRuntime with the command;

new ServerRuntime("cayenne.xml");

It gives the error on the subject line;
 
Caused by: java.lang.NoSuchMethodError: 
org.apache.cayenne.access.QueryLogger.setLogger(Lorg/apache/cayenne/log/JdbcEventLogger;)V

 at 
org.apache.cayenne.configuration.server.ServerModule.configure(ServerModule.java:87)

 at org.apache.cayenne.di.spi.DefaultInjector.<init>(DefaultInjector.java:65)
 at org.apache.cayenne.di.DIBootstrap.createInjector(DIBootstrap.java:38)
 at 
org.apache.cayenne.configuration.CayenneRuntime.<init>(CayenneRuntime.java:92)
 at 
org.apache.cayenne.configuration.server.ServerRuntime.<init>(ServerRuntime.java:50)

I think there is problem in ServerModule;

    CommonsJdbcEventLogger logger = new CommonsJdbcEventLogger();
    QueryLogger.setLogger(logger);

ServerModule sends CommonsJdbcEventLogger but QueryLogger receives that param;
 public static void setLogger(JdbcEventLogger logger)

But how the cayenne could be compiled is mystery for me. Any idea?

(Continue reading)

Øyvind Harboe | 1 Mar 2011 15:18

Re: java.lang.NoSuchMethodError: org.apache.cayenne.access.QueryLogger.setLogger(Lorg/apache/cayenne/log/JdbcEventLogger;)V

You need to load cayenne.xml into the modeler in 3.1 and save
it out again.

It will be converted and saved with a new name, cayenne-foo.xml,
which is what you pass to new ServerRuntime().

--

-- 
Øyvind Harboe

Can Zylin Consulting help on your project?

US toll free 1-866-980-3434 / International +47 51 87 40 27

http://www.zylin.com/zy1000.html
ARM7 ARM9 ARM11 XScale Cortex
JTAG debugger and flash programmer

Andrus Adamchik | 1 Mar 2011 15:18
Favicon

Re: java.lang.NoSuchMethodError: org.apache.cayenne.access.QueryLogger.setLogger(Lorg/apache/cayenne/log/JdbcEventLogger;)V

Are you sure you don't have Cayenne 3.0 in the classpath?

> ServerModule sends CommonsJdbcEventLogger but QueryLogger receives that param;
>  public static void setLogger(JdbcEventLogger logger)
> 
> 
> But how the cayenne could be compiled is mystery for me. Any idea?

CommonsJdbcEventLogger implements JdbcEventLogger

Andrus

On Mar 1, 2011, at 4:15 PM, Erdinc wrote:

> Hi,
> I just downloaded v 3.1M1. When I try to create ServerRuntime with the command;
> 
> new ServerRuntime("cayenne.xml");
> 
> 
> It gives the error on the subject line;
>  
> Caused by: java.lang.NoSuchMethodError: 
> org.apache.cayenne.access.QueryLogger.setLogger(Lorg/apache/cayenne/log/JdbcEventLogger;)V
> 
>  at 
> org.apache.cayenne.configuration.server.ServerModule.configure(ServerModule.java:87)
> 
>  at org.apache.cayenne.di.spi.DefaultInjector.<init>(DefaultInjector.java:65)
>  at org.apache.cayenne.di.DIBootstrap.createInjector(DIBootstrap.java:38)
(Continue reading)

Erdinc | 1 Mar 2011 15:56
Picon
Favicon

Re: java.lang.NoSuchMethodError: org.apache.cayenne.access.QueryLogger.setLogger(Lorg/apache/cayenne/log/JdbcEventLogger;)V


Thank you for your prompt reply. My project depends on 3.1.M1 release, I removed 
3.0 package. I unzip cayenne package and decompiled QueryLogger;

public static void setLogger(JdbcEventLogger logger)
{
logger = logger;
}
 
I see CommonsJdbcEventLogger is a JdbcEventLogger. There should'nt be any 
error.  I didnt understand. I may try on my other machine also ...

________________________________
From: Andrus Adamchik <andrus <at> objectstyle.org>
To: user <at> cayenne.apache.org
Sent: Tue, March 1, 2011 4:18:54 PM
Subject: Re: java.lang.NoSuchMethodError: 
org.apache.cayenne.access.QueryLogger.setLogger(Lorg/apache/cayenne/log/JdbcEventLogger;)V

Are you sure you don't have Cayenne 3.0 in the classpath?

> ServerModule sends CommonsJdbcEventLogger but QueryLogger receives that param;
>  public static void setLogger(JdbcEventLogger logger)
> 
> 
> But how the cayenne could be compiled is mystery for me. Any idea?

CommonsJdbcEventLogger implements JdbcEventLogger

Andrus
(Continue reading)

Bruno René Santos | 6 Mar 2011 11:03
Picon

Querying on Inherited Objects

Hello all,

I have an object structure with a Child dataobject which inherits from a 
Parent which is linked to a db_entity. I am trying to use the Parent on 
a GUI and the Child on another GUI. The Child overrides some methods 
from the Parent (but the db table is the same) and so is mandatory that 
on each GUI their respective searches yeld Child objects or Parent 
objects. On the GUI that uses the Child everything goes according plan, 
the performQueries return lists of Children. But on the Parent GUI I call

context.performQuery(new SelectQuery(Parent.class))

but the method returns also a list of Children, which are incompatible 
with the parent GUI. Is there any way that this query returns Parents 
instead of Children? I was trying these inheritance so that i could 
reuse all db fields and relationships from the parent on the child.
--

-- 
Bruno René Santos | brunorene <at> holos.pt <mailto:brunorene <at> holos.pt> | 
Gestor de Projectos | Analista | Programador | Investigador

Holos - Soluções Avançadas em Tecnologias de Informação S.A.
Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt

This email and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom they are 
addressed. If you are not the intended recipient or the person 
responsible for delivering the email to the intended recipient, be 
advised that you have received this email in error and that any use, 
(Continue reading)

Aristedes Maniatis | 6 Mar 2011 11:15

Re: Querying on Inherited Objects

On 6/03/11 9:03 PM, Bruno René Santos wrote:
> I have an object structure with a Child dataobject which inherits from a Parent which is linked to a
db_entity. I am trying to use the Parent on a GUI and the Child on another GUI. The Child overrides some
methods from the Parent (but the db table is the same) and so is mandatory that on each GUI their respective
searches yeld Child objects or Parent objects. On the GUI that uses the Child everything goes according
plan, the performQueries return lists of Children. But on the Parent GUI I call
>
> context.performQuery(new SelectQuery(Parent.class))
>
> but the method returns also a list of Children, which are incompatible with the parent GUI. Is there any way
that this query returns Parents instead of Children? I was trying these inheritance so that i could reuse
all db fields and relationships from the parent on the child.

What does the discriminator column say about these objects? Are they actually Child entities in the
database or Parent? They can't be both at the same time.

This isn't like plain-old Java inheritance where you can just cast from one to the other as needed. If you
could, what would happen if you queried for a list of Child objects, casting them as Parents, changed some
Parent attribute and committed the context? Would they now become Parents in the database?

Ari

--

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

Bruno René Santos | 6 Mar 2011 13:18
Picon

Re: Querying on Inherited Objects

Both parent and child are the same on the database level. But each 
object is used differently on the GUI level. As both GUIs must cohexist 
temporarily I thought I could do a child object from the current used 
object and change some logic on it. So i got something like this

Child extends _Child

_Child extends Parent

Parent extends _Parent

_Parent extends CayenneDataObject

The only issue here (at least I think...) is that a performQuery(new 
SelectQuery(Child.class)) will correctly return a list of Child but a 
performQuery(new SelectQuery(Parent.class)) will also return a List of 
Child... Any way to return a List of Parent?

Thanx
Bruno

Em 06-03-2011 10:15, Aristedes Maniatis escreveu:
> On 6/03/11 9:03 PM, Bruno René Santos wrote:
>> I have an object structure with a Child dataobject which inherits 
>> from a Parent which is linked to a db_entity. I am trying to use the 
>> Parent on a GUI and the Child on another GUI. The Child overrides 
>> some methods from the Parent (but the db table is the same) and so is 
>> mandatory that on each GUI their respective searches yeld Child 
>> objects or Parent objects. On the GUI that uses the Child everything 
>> goes according plan, the performQueries return lists of Children. But 
(Continue reading)

Erdinc | 7 Mar 2011 12:45
Picon
Favicon

DI example

Hi,
 
I want try to use DI feature of Cayenne but having difficulty to find a good way to use. My application is a
standalone application.
I created runtime with the command;
ServerRuntime = new ServerRuntime("cayenne-X.xml");
I think I have to implement the "configure" method of a Module object and use the Binder class.
ServerRuntime creates a default module,
but I cant extend it. Do I need to add additional modules or inherit from CayenneRuntime instead of
ServerRuntime or is there any better way to do this simple task??
An example in docs would be greatly appreciated.
 
Thanks,
 
---------------------------------------------------
http://www.nofailtime.com 
Application monitoring
---------------------------------------------------

      
Marcin Skladaniec | 7 Mar 2011 23:24
Picon
Favicon

Re: Querying on Inherited Objects

Hi Bruno

All squares are rectangles, but some rectangles are squares, the query 
for rectangles will also give you squares. This is a valid result from 
cayenne's perspective.

What you looking for is to query for Rectangle but not Square. I see 
three ways of doing that:
- query for Parent, query for Child, subtract results from each other. 
(performQuery(Rectangle).removeAll(performQuery(Square))
- create another subclass of Parent, mutually exclusive with Child, and 
query that. (performQuery(NotSquare))
- expose the qualifier field in cayenne modeler, query with the 
qualifier. (performQuery(Rectangle, 
ExpressionFactory.noMatch(polygonType, square))

With regards
Marcin

On 6/03/11 11:18 PM, Bruno René Santos wrote:
> Both parent and child are the same on the database level. But each 
> object is used differently on the GUI level. As both GUIs must 
> cohexist temporarily I thought I could do a child object from the 
> current used object and change some logic on it. So i got something 
> like this
>
> Child extends _Child
>
> _Child extends Parent
>
(Continue reading)

Aristedes Maniatis | 8 Mar 2011 06:10

Re: Querying on Inherited Objects

On 6/03/11 11:18 PM, Bruno René Santos wrote:
> Both parent and child are the same on the database level.

Maybe you need to explain further what this means. Are you using single table inheritance? Do you have a
disciminator column?

Ari

--

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


Gmane