[forge-issues] [JBoss JIRA] (FORGE-572) Forge scaffold faces creates view beans with Id always Long against user-generated Entities
Will Dinyes (JIRA)
jira-events at lists.jboss.org
Fri May 18 12:08:18 EDT 2012
Will Dinyes created FORGE-572:
---------------------------------
Summary: Forge scaffold faces creates view beans with Id always Long against user-generated Entities
Key: FORGE-572
URL: https://issues.jboss.org/browse/FORGE-572
Project: Forge
Issue Type: Bug
Components: Scaffold
Affects Versions: 1.0.2.Final
Environment: JBoss Developer Studio 5 Beta 2, Embedded Forge 1.0.2.Final
Reporter: Will Dinyes
Priority: Minor
When running:
scaffold from-entity ~.domain.* --overwrite
The generated view Bean will always use an id field as a long, even if the entity uses a different type for the @Id. For instance, this code, in an Entity class called ValMealtype:
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(unique=true, nullable=false, length=20)
private String meal;
Generates, in ValMealtypeBean:
private Long id;
<-- associated gettters and setters -->
And, later in the class:
return ValMealtypeBean.this.entityManager.find(ValMealtype.class, Long.valueOf(value));
That line in particular doesn't work at all, of course, since a Long can't be parsed out of a non-numeric String. I suppose I could name my meals with hex digits . . . CAFE . . . BEEF . . . but sadly, Chicken isn't going to fly.
Basically, scaffold probably needs to look at the type of @Id in the entity and use that to set the id field type in the generated bean.
As this is reported against a non-current release, I understand it may be fixed already. In this case, a new Beta of JBDS 5 is probably in order, as that's where I'm seeing this issue.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the forge-issues
mailing list