cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Kienenberger <mkien...@gmail.com>
Subject Re: CayenneModeler not generating classes
Date Mon, 12 Oct 2015 16:33:08 GMT
I haven't had time to test this yet, but I'm pretty sure that lines 38
& 39 in the template are wrong.

Dipesh,

Go to https://github.com/apache/cayenne/blob/master/cayenne-tools/src/main/resources/templates/v1_2/superclass.vm
in your checkout, and replace lines 38 and 39 with a single line 38
containing:

#if((${object.DeclaredAttributes} &&
!${object.DeclaredAttributes.isEmpty()}) ||
(${object.DeclaredRelationships} &&
!${object.DeclaredRelationships.isEmpty()}))


On Fri, Oct 9, 2015 at 9:26 AM, Mike Kienenberger <mkienenb@gmail.com> wrote:
> The three things needed to track this down are:
>
> 1) The version of velocity you are using -- it looks like the pom.xml
> file asks for 1.6.3, but there are at least two newer versions of
> velocity that something else might be requesting instead.
>
> 2) The template you use using when you get the error.     If you give
> us the exact steps you are taking, (clicked this, clicked that, etc)
> we can verify what that is.  Most likely, it is
> https://github.com/apache/cayenne/blob/master/cayenne-tools/src/main/resources/templates/v1_2/superclass.vm
> as this has the word "and" starting at column 35 on line 38, unless I
> overlooked another template which also has this characteristic.
>
> 3) The data you are putting into the template (probably a specific
> entity is causing it).   Again the exact steps you are taking should
> give us what was selected at the time you generated the classes.
>
> Possibly it's the version of velocity that is the problem.
>
> But the line itself seems odd:
>
> #if((${object.DeclaredAttributes} and
> !${object.DeclaredAttributes.isEmpty()}) or
> (${object.DeclaredRelationships} and
> !${object.DeclaredRelationships.isEmpty()}))
>
> As far as I can tell [ and ] and [ or ] aren't supported in velocity,
> although maybe velocity 2.0 supports it and the docs are out of date.
>  It used to be [ && ] and [ || ].
>
> Second, I use a pretty old version of velocity, but I wasn't aware
> that velocity allowed a directive to span multiple lines.   I would
> expect line 38 and 39 to be on one line.   Again, maybe this is only
> valid under velocity 2.0?
>
> It looks like this was last changed on April, which wasn't that long ago.
>
> On Fri, Oct 9, 2015 at 12:44 AM, Dipesh Jain <dipesh@ivgroup.in> wrote:
>> I also used latest repository from github, Java 1.8.0_51, Windows 7 Pro.
>> but its still not working on my end. Any ideas ?
>>
>> On Tue, Oct 6, 2015 at 11:44 AM, Dipesh Jain <dipesh@ivgroup.in> wrote:
>>
>>> Hi Savva,
>>>
>>> In which environment you are working? Did you build latest repository to reproduce
>>> my error ?
>>>
>>> On Mon, Oct 5, 2015 at 11:06 AM, Dipesh Jain <dipesh@ivgroup.in> wrote:
>>>
>>>> I am using JAVA 8 and Here is my
>>>>
>>>> *cayenne-IV.xml*
>>>>
>>>> <?xml version="1.0" encoding="utf-8"?>
>>>> <domain project-version="7">
>>>> <map name="MastersDataMap"/>
>>>>
>>>> <node name="MastersDataNode"
>>>> factory="org.apache.cayenne.configuration.server.DBCPDataSourceFactory"
>>>> parameters="mastersdbcp.properties"
>>>>
>>>> schema-update-strategy="org.apache.cayenne.access.dbsync.CreateIfNoSchemaStrategy"
>>>> >
>>>> <map-ref name="MastersDataMap"/>
>>>> </node>
>>>> </domain>
>>>>
>>>> *MasterDataMap.map.xml*
>>>>
>>>> <?xml version="1.0" encoding="utf-8"?>
>>>> <data-map xmlns="http://cayenne.apache.org/schema/7/modelMap"
>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>> xsi:schemaLocation="http://cayenne.apache.org/schema/7/modelMap
>>>> http://cayenne.apache.org/schema/7/modelMap.xsd"
>>>> project-version="7">
>>>> <property name="defaultPackage" value="com.org.ivcargo.platform.dto"/>
>>>> <db-entity name="PersonTemp" schema="dbo" catalog="test">
>>>> <db-attribute name="address" type="VARCHAR" length="100"/>
>>>> <db-attribute name="birthdate" type="DATE" length="10"/>
>>>> <db-attribute name="city" type="VARCHAR" length="100"/>
>>>> <db-attribute name="companyName" type="VARCHAR" length="100"/>
>>>> <db-attribute name="country" type="VARCHAR" length="100"/>
>>>> <db-attribute name="countryCode" type="VARCHAR" length="50"/>
>>>> <db-attribute name="createdOn" type="DATE" length="10"/>
>>>> <db-attribute name="creditCardNo" type="VARCHAR" length="100"/>
>>>> <db-attribute name="domain" type="VARCHAR" length="50"/>
>>>> <db-attribute name="domainName" type="VARCHAR" length="100"/>
>>>> <db-attribute name="email" type="VARCHAR" length="100"/>
>>>> <db-attribute name="firstName" type="VARCHAR" length="100"/>
>>>> <db-attribute name="gender" type="VARCHAR" length="50"/>
>>>> <db-attribute name="ipaddress" type="VARCHAR" length="30"/>
>>>> <db-attribute name="jobTitle" type="VARCHAR" length="100"/>
>>>> <db-attribute name="language" type="VARCHAR" length="50"/>
>>>> <db-attribute name="lastName" type="VARCHAR" length="100"/>
>>>> <db-attribute name="macAddress" type="VARCHAR" length="100"/>
>>>> <db-attribute name="markForDelete" type="BIT" length="1"/>
>>>> <db-attribute name="moblie" type="VARCHAR" length="50"/>
>>>> <db-attribute name="modifiedOn" type="DATE" length="10"/>
>>>> <db-attribute name="password" type="VARCHAR" length="50"/>
>>>> <db-attribute name="personId" type="NUMERIC" isPrimaryKey="true"
>>>> isGenerated="true" isMandatory="true" length="10"/>
>>>> <db-attribute name="socialSecurityNumber" type="VARCHAR" length="100"/>
>>>> <db-attribute name="state" type="VARCHAR" length="100"/>
>>>> <db-attribute name="streetName" type="VARCHAR" length="100"/>
>>>> <db-attribute name="streetNumber" type="NUMERIC" length="10"/>
>>>> <db-attribute name="title" type="VARCHAR" length="50"/>
>>>> <db-attribute name="url" type="VARCHAR" length="2000"/>
>>>> <db-attribute name="userName" type="VARCHAR" length="50"/>
>>>> <db-attribute name="zipcode" type="NUMERIC" length="10"/>
>>>> </db-entity>
>>>> <obj-entity name="PersonTemp"
>>>> className="com.org.ivcargo.platform.dto.PersonTemp"
>>>> dbEntityName="PersonTemp">
>>>> <obj-attribute name="address" type="java.lang.String"
>>>> db-attribute-path="address"/>
>>>> <obj-attribute name="birthdate" type="java.util.Date"
>>>> db-attribute-path="birthdate"/>
>>>> <obj-attribute name="city" type="java.lang.String"
>>>> db-attribute-path="city"/>
>>>> <obj-attribute name="companyName" type="java.lang.String"
>>>> db-attribute-path="companyName"/>
>>>> <obj-attribute name="country" type="java.lang.String"
>>>> db-attribute-path="country"/>
>>>> <obj-attribute name="countryCode" type="java.lang.String"
>>>> db-attribute-path="countryCode"/>
>>>> <obj-attribute name="createdOn" type="java.util.Date"
>>>> db-attribute-path="createdOn"/>
>>>> <obj-attribute name="creditCardNo" type="java.lang.String"
>>>> db-attribute-path="creditCardNo"/>
>>>> <obj-attribute name="domain" type="java.lang.String"
>>>> db-attribute-path="domain"/>
>>>> <obj-attribute name="domainName" type="java.lang.String"
>>>> db-attribute-path="domainName"/>
>>>> <obj-attribute name="email" type="java.lang.String"
>>>> db-attribute-path="email"/>
>>>> <obj-attribute name="firstName" type="java.lang.String"
>>>> db-attribute-path="firstName"/>
>>>> <obj-attribute name="gender" type="java.lang.String"
>>>> db-attribute-path="gender"/>
>>>> <obj-attribute name="ipaddress" type="java.lang.String"
>>>> db-attribute-path="ipaddress"/>
>>>> <obj-attribute name="jobTitle" type="java.lang.String"
>>>> db-attribute-path="jobTitle"/>
>>>> <obj-attribute name="language" type="java.lang.String"
>>>> db-attribute-path="language"/>
>>>> <obj-attribute name="lastName" type="java.lang.String"
>>>> db-attribute-path="lastName"/>
>>>> <obj-attribute name="macAddress" type="java.lang.String"
>>>> db-attribute-path="macAddress"/>
>>>> <obj-attribute name="markForDelete" type="java.lang.Boolean"
>>>> db-attribute-path="markForDelete"/>
>>>> <obj-attribute name="moblie" type="java.lang.String"
>>>> db-attribute-path="moblie"/>
>>>> <obj-attribute name="modifiedOn" type="java.util.Date"
>>>> db-attribute-path="modifiedOn"/>
>>>> <obj-attribute name="password" type="java.lang.String"
>>>> db-attribute-path="password"/>
>>>> <obj-attribute name="personId" type="java.lang.Long" lock="true"
>>>> db-attribute-path="personId"/>
>>>> <obj-attribute name="socialSecurityNumber" type="java.lang.String"
>>>> db-attribute-path="socialSecurityNumber"/>
>>>> <obj-attribute name="state" type="java.lang.String"
>>>> db-attribute-path="state"/>
>>>> <obj-attribute name="streetName" type="java.lang.String"
>>>> db-attribute-path="streetName"/>
>>>> <obj-attribute name="streetNumber" type="java.lang.Long"
>>>> db-attribute-path="streetNumber"/>
>>>> <obj-attribute name="title" type="java.lang.String"
>>>> db-attribute-path="title"/>
>>>> <obj-attribute name="url" type="java.lang.String"
>>>> db-attribute-path="url"/>
>>>> <obj-attribute name="userName" type="java.lang.String"
>>>> db-attribute-path="userName"/>
>>>> <obj-attribute name="zipcode" type="java.lang.Long"
>>>> db-attribute-path="zipcode"/>
>>>> </obj-entity>
>>>> </data-map>
>>>>
>>>>
>>>>
>>>> On Sat, Oct 3, 2015 at 10:10 AM, Dipesh Jain <dipesh@ivgroup.in> wrote:
>>>>
>>>>> Nope. I was just doing simple example which was working in Cayenne 4.2.
>>>>>
>>>>> On Tue, Sep 29, 2015 at 5:21 PM, Dipesh Jain <dipesh@ivgroup.in>
wrote:
>>>>>
>>>>>> I have downloaded CayenneModeler 4.3 repository repository from
>>>>>> https://github.com/apache/cayenne and build it with maven because
>>>>>> CayenneModeler 4.2 was always showing empty change list when migrating
>>>>>> database. So when I generated classes form 4.3 cayenne logger shows
this
>>>>>> error :-
>>>>>>
>>>>>> Sep 29, 2015 5:10:58 PM
>>>>>> ERROR: Error generating classes
>>>>>> org.apache.velocity.exception.ParseErrorException: Encountered "and"
at
>>>>>> line 38, column 35.
>>>>>> Was expecting one of:
>>>>>>     <RPAREN> ...
>>>>>>     "-" ...
>>>>>>     "+" ...
>>>>>>     "*" ...
>>>>>>     "/" ...
>>>>>>     "%" ...
>>>>>>     "&&" ...
>>>>>>     "||" ...
>>>>>>     "<" ...
>>>>>>     "<=" ...
>>>>>>     ">" ...
>>>>>>     ">=" ...
>>>>>>     "==" ...
>>>>>>     "!=" ...
>>>>>>     "=" ...
>>>>>>
>>>>>> at org.apache.velocity.Template.process(Template.java:181)
>>>>>> at
>>>>>> org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:466)
>>>>>> at
>>>>>> org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:384)
>>>>>> at
>>>>>> org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:814)
>>>>>> at
>>>>>> org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:796)
>>>>>> at
>>>>>> org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:512)
>>>>>> at
>>>>>> org.apache.cayenne.gen.ClassGenerationAction.getTemplate(ClassGenerationAction.java:272)
>>>>>> at
>>>>>> org.apache.cayenne.gen.ClassGenerationAction.execute(ClassGenerationAction.java:238)
>>>>>> at
>>>>>> org.apache.cayenne.gen.ClassGenerationAction.execute(ClassGenerationAction.java:211)
>>>>>> at
>>>>>> org.apache.cayenne.modeler.dialog.codegen.CodeGeneratorController.generateAction(CodeGeneratorController.java:146)
>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>>>>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>>>>> at java.lang.reflect.Method.invoke(Unknown Source)
>>>>>> at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:491)
>>>>>> at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:785)
>>>>>> at ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:61)
>>>>>> at ognl.OgnlRuntime.callMethod(OgnlRuntime.java:819)
>>>>>> at ognl.ASTMethod.getValueBody(ASTMethod.java:75)
>>>>>> at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
>>>>>> at ognl.SimpleNode.getValue(SimpleNode.java:210)
>>>>>> at ognl.Ognl.getValue(Ognl.java:333)
>>>>>> at ognl.Ognl.getValue(Ognl.java:413)
>>>>>> at ognl.Ognl.getValue(Ognl.java:395)
>>>>>> at org.apache.cayenne.swing.BindingBase.getValue(BindingBase.java:168)
>>>>>> at
>>>>>> org.apache.cayenne.swing.ActionBinding.fireAction(ActionBinding.java:80)
>>>>>> at
>>>>>> org.apache.cayenne.swing.ActionBinding$1.actionPerformed(ActionBinding.java:42)
>>>>>> at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
>>>>>> at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
>>>>>> at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
>>>>>> at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
>>>>>> at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown
>>>>>> Source)
>>>>>> at java.awt.Component.processMouseEvent(Unknown Source)
>>>>>> at javax.swing.JComponent.processMouseEvent(Unknown Source)
>>>>>> at java.awt.Component.processEvent(Unknown Source)
>>>>>> at java.awt.Container.processEvent(Unknown Source)
>>>>>> at java.awt.Component.dispatchEventImpl(Unknown Source)
>>>>>> at java.awt.Container.dispatchEventImpl(Unknown Source)
>>>>>> at java.awt.Component.dispatchEvent(Unknown Source)
>>>>>> at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
>>>>>> at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
>>>>>> at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
>>>>>> at java.awt.Container.dispatchEventImpl(Unknown Source)
>>>>>> at java.awt.Window.dispatchEventImpl(Unknown Source)
>>>>>> at java.awt.Component.dispatchEvent(Unknown Source)
>>>>>> at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
>>>>>> at java.awt.EventQueue.access$500(Unknown Source)
>>>>>> at java.awt.EventQueue$3.run(Unknown Source)
>>>>>> at java.awt.EventQueue$3.run(Unknown Source)
>>>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>>>> at
>>>>>> java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown
>>>>>> Source)
>>>>>> at
>>>>>> java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown
>>>>>> Source)
>>>>>> at java.awt.EventQueue$4.run(Unknown Source)
>>>>>> at java.awt.EventQueue$4.run(Unknown Source)
>>>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>>>> at
>>>>>> java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown
>>>>>> Source)
>>>>>> at java.awt.EventQueue.dispatchEvent(Unknown Source)
>>>>>> at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
>>>>>> at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
>>>>>> at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
>>>>>> at java.awt.WaitDispatchSupport$2.run(Unknown Source)
>>>>>> at java.awt.WaitDispatchSupport$4.run(Unknown Source)
>>>>>> at java.awt.WaitDispatchSupport$4.run(Unknown Source)
>>>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>>>> at java.awt.WaitDispatchSupport.enter(Unknown Source)
>>>>>> at java.awt.Dialog.show(Unknown Source)
>>>>>> at java.awt.Component.show(Unknown Source)
>>>>>> at java.awt.Component.setVisible(Unknown Source)
>>>>>> at java.awt.Window.setVisible(Unknown Source)
>>>>>> at java.awt.Dialog.setVisible(Unknown Source)
>>>>>> at
>>>>>> org.apache.cayenne.modeler.dialog.codegen.CodeGeneratorController.startup(CodeGeneratorController.java:74)
>>>>>> at
>>>>>> org.apache.cayenne.modeler.action.GenerateCodeAction.performAction(GenerateCodeAction.java:55)
>>>>>> at
>>>>>> org.apache.cayenne.modeler.util.CayenneAction.actionPerformed(CayenneAction.java:162)
>>>>>> at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
>>>>>> at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
>>>>>> at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
>>>>>> at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
>>>>>> at javax.swing.AbstractButton.doClick(Unknown Source)
>>>>>> at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
>>>>>> at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown
>>>>>> Source)
>>>>>> at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
>>>>>> at java.awt.Component.processMouseEvent(Unknown Source)
>>>>>> at javax.swing.JComponent.processMouseEvent(Unknown Source)
>>>>>> at java.awt.Component.processEvent(Unknown Source)
>>>>>> at java.awt.Container.processEvent(Unknown Source)
>>>>>> at java.awt.Component.dispatchEventImpl(Unknown Source)
>>>>>> at java.awt.Container.dispatchEventImpl(Unknown Source)
>>>>>> at java.awt.Component.dispatchEvent(Unknown Source)
>>>>>> at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
>>>>>> at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
>>>>>> at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
>>>>>> at java.awt.Container.dispatchEventImpl(Unknown Source)
>>>>>> at java.awt.Window.dispatchEventImpl(Unknown Source)
>>>>>> at java.awt.Component.dispatchEvent(Unknown Source)
>>>>>> at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
>>>>>> at java.awt.EventQueue.access$500(Unknown Source)
>>>>>> at java.awt.EventQueue$3.run(Unknown Source)
>>>>>> at java.awt.EventQueue$3.run(Unknown Source)
>>>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>>>> at
>>>>>> java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown
>>>>>> Source)
>>>>>> at
>>>>>> java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown
>>>>>> Source)
>>>>>> at java.awt.EventQueue$4.run(Unknown Source)
>>>>>> at java.awt.EventQueue$4.run(Unknown Source)
>>>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>>>> at
>>>>>> java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown
>>>>>> Source)
>>>>>> at java.awt.EventQueue.dispatchEvent(Unknown Source)
>>>>>> at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
>>>>>> at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
>>>>>> at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
>>>>>> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
>>>>>> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
>>>>>> at java.awt.EventDispatchThread.run(Unknown Source)
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Thanks and Regards
>>>>>> Deepesh Jain
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Thanks and Regards
>>>>> Deepesh Jain
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Thanks and Regards
>>>> Deepesh Jain
>>>>
>>>
>>>
>>>
>>> --
>>> Thanks and Regards
>>> Deepesh Jain
>>>
>>
>>
>>
>> --
>> Thanks and Regards
>> Deepesh Jain

Mime
View raw message