]
claudio perrotta reopened FORGE-572:
------------------------------------
Assignee: (was: Ricardo Martinelli Oliveira)
This behavior is still present for me. Either with 1.2.2.Final and 1.2.3.Final
All my entities generates a bean in which there is an id with type Long, no matter if the
key is int or String, neither if it is composed or referenced.
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
Labels: starter
Fix For: 1.1.0.Final
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
For more information on JIRA, see: