[
http://opensource.atlassian.com/projects/hibernate/browse/HBX-1004?page=c...
]
Viorel Andronic commented on HBX-1004:
--------------------------------------
Hello,
At a first glance it seems to work ... but it doesn't in all cases ... I believe that
is something with composite keys
This is the stack trace i get when runing a seam CRUD generation with this
GetPropertyAnnotation.ftl
2007-10-26 15:37:45,390 ERROR ModalContext freemarker.runtime -
Expression pojo.identifierProperty is undefined on line 2, column 29 in
pojo/GetPropertyAnnotation.ftl.
The problematic instruction:
----------
==> if !property.optional && !pojo.identifierProperty.equals(property) [on line
2, column 1 in pojo/GetPropertyAnnotation.ftl]
in include "GetPropertyAnnotation.ftl" [on line 9, column 5 in
pojo/PojoPropertyAccessors.ftl]
in include "PojoPropertyAccessors.ftl" [on line 12, column 1 in pojo/Pojo.ftl]
----------
Java backtrace for programmers:
----------
freemarker.core.InvalidReferenceException: Expression pojo.identifierProperty is undefined
on line 2, column 29 in pojo/GetPropertyAnnotation.ftl.
at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:134)
at freemarker.core.Dot._getAsTemplateModel(Dot.java:78)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:86)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.Expression.isTrue(Expression.java:138)
at freemarker.core.NotExpression.isTrue(NotExpression.java:66)
at freemarker.core.AndExpression.isTrue(AndExpression.java:68)
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:77)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.include(Environment.java:1375)
at freemarker.core.Include.accept(Include.java:155)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:160)
at freemarker.core.Environment.visit(Environment.java:351)
at freemarker.core.IteratorBlock.accept(IteratorBlock.java:95)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.include(Environment.java:1375)
at freemarker.core.Include.accept(Include.java:155)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.IfBlock.accept(IfBlock.java:82)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.visit(Environment.java:233)
at freemarker.core.BlockAssignment.accept(BlockAssignment.java:83)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.process(Environment.java:176)
at freemarker.template.Template.process(Template.java:232)
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:251)
at org.hibernate.tool.hbm2x.TemplateProducer.produceToString(TemplateProducer.java:67)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:28)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:97)
at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.java:146)
at org.hibernate.tool.hbm2x.GenericExporter.exportComponent(GenericExporter.java:131)
at org.hibernate.tool.hbm2x.GenericExporter$3.process(GenericExporter.java:61)
at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java:126)
at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:95)
at
org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate$1.execute(CodeGenerationLaunchDelegate.java:245)
at
org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:88)
at
org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.runExporters(CodeGenerationLaunchDelegate.java:215)
at
org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.launch(CodeGenerationLaunchDelegate.java:130)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:766)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:608)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:899)
at org.eclipse.debug.internal.ui.DebugUIPlugin$6.run(DebugUIPlugin.java:985)
at
org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113)
Actually, I'm sure it has something to do with composite ids, as when excluding that
table i don't get the exception any more
This is the table that generates the trouble
CREATE TABLE smp.good
(
product_id integer NOT NULL,
document_id integer NOT NULL,
price numeric(9,2), -- the price of the product in this document
quantity numeric(7,2), -- the quantity of the product in this document
discount numeric(5,2), -- special discount percentage for the product in this document
unit character varying(20), -- the measurement unit for the current quantity
observations text, -- special observations for the product in this document
CONSTRAINT good_pkey PRIMARY KEY (product_id, document_id),
CONSTRAINT good_document_id_fkey FOREIGN KEY (document_id)
REFERENCES smp.document (id) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE RESTRICT,
CONSTRAINT good_product_id_fkey FOREIGN KEY (product_id)
REFERENCES smp.product (id) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE RESTRICT
)
WITH (OIDS=TRUE);
ALTER TABLE smp.good OWNER TO root;
Bugs affecting seam-gen and JBoss Tools
---------------------------------------
Key: HBX-1004
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HBX-1004
Project: Hibernate Tools
Issue Type: Bug
Components: hbm2java
Reporter: Gavin King
Assignee: Max Rydahl Andersen
Priority: Critical
The following problems need to be solved for JBoss tools:
* @Id @GeneratedValue attributes should NEVER have @NotNull generated!
* MySQL internally stores columns of type NUMERIC as DECIMAL - we should change
MySQLDialect to generate DECIMAL in the DDL, or we should hack SchemaExport to consider
NUMERIC and DECIMAL is "equal" for the purposes of validation
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira