Is it because you're not specifying the additional data maps to cgen?
>From one of my 1.2/2.0 projects:
<cgen map="${template.datamap}"
additionalMaps="${additional.template.datamaps}"
version="1.2"
makepairs="false"
overwrite="false"
mode="entity"
destDir="${dataMapModelPackageDir}/entity"
superpkg="${dataMapModelPackage}.entity.cayenne.generated"
template="${template.subclass.interface}"
usepkgpath="false">
</cgen>
On Tue, Mar 2, 2010 at 11:28 PM, Parth Pandya <[email protected]> wrote:
> Can anyone help?? Does anyone know if cdbgen task will work with multiple
> maps or not??
>
> Regards,
> Parth
>
> -----Original Message-----
> From: Parth Pandya
> Sent: Tuesday, 2 March 2010 3:48 PM
> To: [email protected]
> Subject: 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:[email protected]]
> Sent: Tuesday, 2 March 2010 3:23 PM
> To: [email protected]
> Subject: 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 <[email protected]> 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="com.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:[email protected]]
>> Sent: Tuesday, 2 March 2010 3:03 PM
>> To: [email protected]
>> 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 <[email protected]> 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
>>>
>>> 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)
>>> at org.apache.tools.ant.Task.perform(Task.java:348)
>>> at org.apache.tools.ant.Target.execute(Target.java:357)
>>> at org.apache.tools.ant.Target.performTasks(Target.java:385)
>>> at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
>>> at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
>>> at
>>> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
>>> at
>>> org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
>>> at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
>>> at
>>> org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
>>> at
>>> org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
>>> Caused by: java.lang.NullPointerException
>>> at
>>> org.apache.cayenne.map.AshwoodEntitySorter.fillInMetadata(AshwoodEntitySorter.java:264)
>>> at
>>> org.apache.cayenne.map.AshwoodEntitySorter._indexSorter(AshwoodEntitySorter.java:97)
>>> at
>>> org.apache.cayenne.map.AshwoodEntitySorter.sortDbEntities(AshwoodEntitySorter.java:136)
>>> at
>>> org.apache.cayenne.access.DbGenerator.prepareDbEntities(DbGenerator.java:582)
>>> at org.apache.cayenne.access.DbGenerator.<init>(DbGenerator.java:132)
>>> at org.apache.cayenne.access.DbGenerator.<init>(DbGenerator.java:105)
>>> at org.apache.cayenne.access.DbGenerator.<init>(DbGenerator.java:93)
>>> at
>>> org.apache.cayenne.tools.DbGeneratorTask.execute(DbGeneratorTask.java:71)
>>> ... 16 more
>>> --- Nested Exception ---
>>> java.lang.NullPointerException
>>> at
>>> org.apache.cayenne.map.AshwoodEntitySorter.fillInMetadata(AshwoodEntitySorter.java:264)
>>> at
>>> org.apache.cayenne.map.AshwoodEntitySorter._indexSorter(AshwoodEntitySorter.java:97)
>>> at
>>> org.apache.cayenne.map.AshwoodEntitySorter.sortDbEntities(AshwoodEntitySorter.java:136)
>>> at
>>> org.apache.cayenne.access.DbGenerator.prepareDbEntities(DbGenerator.java:582)
>>> at org.apache.cayenne.access.DbGenerator.<init>(DbGenerator.java:132)
>>> at org.apache.cayenne.access.DbGenerator.<init>(DbGenerator.java:105)
>>> at org.apache.cayenne.access.DbGenerator.<init>(DbGenerator.java:93)
>>> at
>>> org.apache.cayenne.tools.DbGeneratorTask.execute(DbGeneratorTask.java:71)
>>> 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)
>>> at org.apache.tools.ant.Task.perform(Task.java:348)
>>> at org.apache.tools.ant.Target.execute(Target.java:357)
>>> at org.apache.tools.ant.Target.performTasks(Target.java:385)
>>> at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
>>> at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
>>> at
>>> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
>>> at
>>> org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
>>> at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
>>> at
>>> org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
>>> at
>>> org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
>>>
>>>
>>>
>>>
>>
>>>
>>>
>>
>>>
>>>
>>
>