Parth Pandya | 2 Mar 2010 04:59
Favicon

cdbgen problem for SQLServer on RC2

Hi Guys,
I'm trying to use cdbgen task in my Ant script and I'm getting NPE.
Here is the ant code and the exception. Can anyone please help??
Thanks in advance.
Cheers,
Parth

From Ant build:
<target name="create-db" description="build the Coffeshop database">
        <cdbgen map="${src.dir}/CoffeshopMap.map.xml"
                adapter="org.apache.cayenne.dba.sqlserver.SQLServerAdapter"
                driver="om.microsoft.jdbc.sqlserver.SQLServerDriver"
                url="jdbc:sqlserver://localhost:1433;databaseName=coffeshop;SelectMethod=cursor"
                username="coffeshop"
                password="password"/>
</target>

Exception
generator options - [dropTables: false, dropPK: false, createTables: true, createPK: true, createFK: true]
   [cdbgen] Error generating database

BUILD FAILED
C:\dev\myEclipseTelstraWorkspace\telstra.all4biz.portal\edge-build.xml:293: Error generating database
      at org.apache.cayenne.tools.DbGeneratorTask.execute(DbGeneratorTask.java:94)
      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
(Continue reading)

Kevin Menard | 2 Mar 2010 05:02
Picon
Gravatar

Re: cdbgen problem for SQLServer on RC2

I'm seeing the same thing now.  In my case it looks like the JDBC
driver isn't being loaded off the classpath.  But I haven't had the
time to dig into it more to see why that may be or at what point it
broke.

-- 
Kevin

On Mon, Mar 1, 2010 at 10:59 PM, Parth Pandya <ppandya <at> avoka.com> wrote:
> Hi Guys,
> I'm trying to use cdbgen task in my Ant script and I'm getting NPE.
> Here is the ant code and the exception. Can anyone please help??
> Thanks in advance.
> Cheers,
> Parth
>
> From Ant build:
> <target name="create-db" description="build the Coffeshop database">
>        <cdbgen map="${src.dir}/CoffeshopMap.map.xml"
>                adapter="org.apache.cayenne.dba.sqlserver.SQLServerAdapter"
>                driver="om.microsoft.jdbc.sqlserver.SQLServerDriver"
>                url="jdbc:sqlserver://localhost:1433;databaseName=coffeshop;SelectMethod=cursor"
>                username="coffeshop"
>                password="password"/>
> </target>
>
> Exception
> generator options - [dropTables: false, dropPK: false, createTables: true, createPK: true, createFK: true]
>   [cdbgen] Error generating database
>
(Continue reading)

Parth Pandya | 2 Mar 2010 05:10
Favicon

RE: cdbgen problem for SQLServer on RC2

Hi,
I've double checked that driver loading and that seem to be fine for me. The driver jar is in classpath and
I've tried adding classpathref to the task as well but that didn't help.
With classpathref the ant code looked like this. I've cayenne tools and cayenne server jars in the classpath.
Regards,
Parth

<cdbgen map="${src.dir}/CoffeshopMap.map.xml"
                adapter="org.apache.cayenne.dba.sqlserver.SQLServerAdapter"
                driver="om.microsoft.jdbc.sqlserver.SQLServerDriver"
                url="jdbc:sqlserver://localhost:1433;databaseName=coffeshop;SelectMethod=cursor"
                username="coffeshop"
                password="password"
classpathref="${cayenne.build.classpath}"/>

-----Original Message-----
From: Kevin Menard [mailto:nirvdrum <at> gmail.com] 
Sent: Tuesday, 2 March 2010 3:03 PM
To: user <at> cayenne.apache.org
Subject: Re: cdbgen problem for SQLServer on RC2

I'm seeing the same thing now.  In my case it looks like the JDBC
driver isn't being loaded off the classpath.  But I haven't had the
time to dig into it more to see why that may be or at what point it
broke.

--

-- 
Kevin

On Mon, Mar 1, 2010 at 10:59 PM, Parth Pandya <ppandya <at> avoka.com> wrote:
(Continue reading)

Sudheer | 2 Mar 2010 05:14
Picon

Re: Custom PK and Pagination


I think problem is I did not override setJdbcObject() in my custom type.
After doing that it started working. Now I am using 3.0.
--

-- 
View this message in context: http://n3.nabble.com/Custom-PK-and-Pagination-tp417066p423238.html
Sent from the Cayenne - User mailing list archive at Nabble.com.

Sudheer | 2 Mar 2010 05:19
Picon

Direct mapping between Named query and Pojo


Is it possible to have ditect mapping between named query and pojo? If not
mapping, is there API to convert named query result to a pojo list?

I am using Cayenne 3.0.

Thanks in advance :).
--

-- 
View this message in context: http://n3.nabble.com/Direct-mapping-between-Named-query-and-Pojo-tp423239p423239.html
Sent from the Cayenne - User mailing list archive at Nabble.com.

Kevin Menard | 2 Mar 2010 05:22
Picon
Gravatar

Re: cdbgen problem for SQLServer on RC2

Sorry, I spoke too soon.  I'm having issues with the maven task, so a
completely different classpath/classworld thing.  So, we may be seeing
two separate problems.  Apologies for the confusion.

-- 
Kevin

On Mon, Mar 1, 2010 at 11:10 PM, Parth Pandya <ppandya <at> avoka.com> wrote:
> Hi,
> I've double checked that driver loading and that seem to be fine for me. The driver jar is in classpath and
I've tried adding classpathref to the task as well but that didn't help.
> With classpathref the ant code looked like this. I've cayenne tools and cayenne server jars in the classpath.
> Regards,
> Parth
>
> <cdbgen map="${src.dir}/CoffeshopMap.map.xml"
>                adapter="org.apache.cayenne.dba.sqlserver.SQLServerAdapter"
>                driver="om.microsoft.jdbc.sqlserver.SQLServerDriver"
>                url="jdbc:sqlserver://localhost:1433;databaseName=coffeshop;SelectMethod=cursor"
>                username="coffeshop"
>                password="password"
> classpathref="${cayenne.build.classpath}"/>
>
>
> -----Original Message-----
> From: Kevin Menard [mailto:nirvdrum <at> gmail.com]
> Sent: Tuesday, 2 March 2010 3:03 PM
> To: user <at> cayenne.apache.org
> Subject: Re: cdbgen problem for SQLServer on RC2
>
(Continue reading)

Parth Pandya | 2 Mar 2010 05:48
Favicon

RE: cdbgen problem for SQLServer on RC2

Hi Guys,
I tried with the simplest map and it is working in RC2 against sql server.
Then I switched to my 'proper' map and it failed.
What I have is something like this.

I've two mappings file in a cayenne project. The first map references the other map and its used for few join tables.

It would be good if someone can confirm that passing one of the map file to cdbgen task will/will not work. I
want to generate tables out of the first map and not for the reference map.

I've a typo in my below mentioned ant code so plz ignore it.
The corrected ant code looks like this.

> <cdbgen map="${src.dir}/CoffeshopMap.map.xml"
>                adapter="org.apache.cayenne.dba.sqlserver.SQLServerAdapter"
>                driver="com.microsoft.sqlserver.jdbc.SQLServerDriver"
>                url="jdbc:sqlserver://localhost:1433;databaseName=coffeshop;SelectMethod=cursor"
>                username="coffeshop"
>                password="password"
> classpathref="${cayenne.build.classpath}"/>
>

Thanks,
Parth

-----Original Message-----
From: Kevin Menard [mailto:nirvdrum <at> gmail.com] 
Sent: Tuesday, 2 March 2010 3:23 PM
To: user <at> cayenne.apache.org
Subject: Re: cdbgen problem for SQLServer on RC2
(Continue reading)

Sudheer | 2 Mar 2010 14:47
Picon

Re: Direct mapping between Named query and Pojo


Can someone respond to this? I am in urgency to finish evaluating Cayenne for
my requirement. Thanks in advance.
--

-- 
View this message in context: http://n3.nabble.com/Direct-mapping-between-Named-query-and-Pojo-tp423239p424021.html
Sent from the Cayenne - User mailing list archive at Nabble.com.

Andrus Adamchik | 2 Mar 2010 15:58
Favicon

Re: Direct mapping between Named query and Pojo

Named queries behave the same way as API-based queries. So you can  
used a named query to get a list of DataObjects:

http://cayenne.apache.org/doc30/namedquery.html

Not clear if this is what you meant by POJOs?

And of course they can also perform updates and EJBQL named queries  
can return lists of scalars, etc.

Andrus

On Mar 1, 2010, at 11:19 PM, Sudheer wrote:

>
> Is it possible to have ditect mapping between named query and pojo?  
> If not
> mapping, is there API to convert named query result to a pojo list?
>
> I am using Cayenne 3.0.
>
> Thanks in advance :).
> -- 
> View this message in context: http://n3.nabble.com/Direct-mapping-between-Named-query-and-Pojo-tp423239p423239.html
> Sent from the Cayenne - User mailing list archive at Nabble.com.
>

Michael Martineau | 2 Mar 2010 19:52
Favicon

Re: Using the Cayenne API to dynamically create DataDomains

Andrus,

Thanks for the reply.  For those interested and for future reference, 
here is what I came up with.  It seems to work just fine.  The 
"template" datasouce is setup using the Modeler to use DBCP.  I'm new to 
Cayenne, so this may not be the best way. If anyone with more experience 
wants to comment, I would appreciate the feedback.

- Michael Martineau

public class Main4
{
     public static void main(String[] args) throws SQLException
     {
         Main4 main = new Main4();

         main.createNewDataDomain("db0");
         main.addUser("db0", "Michael");

         main.createNewDataDomain("db1");
         main.addUser("db1", "Rebekah");

         main.createNewDataDomain("db2");
         main.addUser("db2", "Andrew");

         main.createNewDataDomain("db3");
         main.addUser("db3", "Rachael");

         System.exit(0);
     }
(Continue reading)


Gmane