[forge-issues] [JBoss JIRA] (FORGE-572) Forge scaffold faces creates view beans with Id always Long against user-generated Entities

claudio perrotta (JIRA) jira-events at lists.jboss.org
Wed Apr 24 13:15:54 EDT 2013


    [ https://issues.jboss.org/browse/FORGE-572?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12769956#comment-12769956 ] 

claudio perrotta commented on FORGE-572:
----------------------------------------

@Vineet i think that the problem is still present and the bug must be reopened, because it's not only related to the UI (that not showing the field like pointed in https://issues.jboss.org/browse/FORGE-870) but, with preloaded data in the database or insert data with PK set to auto increment, i see the entries but if i click it for the detail i have an error like this in console : Provided id of the wrong type for class org.forgetest.model.GeoCities. Expected: class java.lang.String, got class java.lang.Long.

Now i have tried to add an id column (BIGINT) to all table and make it PK as a workaround..it works
I can add and view data...but i found other three bug.

One is https://issues.jboss.org/browse/FORGE-870, i have it for example in all Many-to-Many table.

Second is that : if there is a column which reference a PK of the another table the GUI show a dropdown menu( with "non-human meaning" value ). after setting this value and saving, all seems ok, but when i want to modify something for this record the GUI not show me the value that was setted. it's not much clear, i know..

Third (but i think its related to Hibernate) : i have two table with a 1:1 identifying relatioship, and so they have the same PK, when generate entities have a method for the class like

public void newStrCustomServices()

{ this.getStrCustomServices = new StrCustomServices(); }

but there isn't any attribute in the class like "getStrCustomServices", to fix i need to change it in "strCustomServices", and so the UI work but with the previous first bug.
                
> 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
>            Assignee: Vineet Reynolds
>            Priority: Minor
>              Labels: starter
>             Fix For: 1.2.4.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: http://www.atlassian.com/software/jira


More information about the forge-issues mailing list