[JBoss JIRA] (FORGE-572) Forge scaffold faces creates view beans with Id always Long against user-generated Entities
by claudio perrotta (JIRA)
[ https://issues.jboss.org/browse/FORGE-572?page=com.atlassian.jira.plugin.... ]
claudio perrotta edited comment on FORGE-572 at 4/23/13 4:52 PM:
-----------------------------------------------------------------
I'll try to describe my scenario.
First i have designed a DB with MySql Workbench.
Then i create a project through forge with this sequence of commands
1) new-project --named forgetest --topLevelPackage org.forgetest
2) persistence setup --provider HIBERNATE --container JBOSS_AS7 ; …
[View More](and choosed org.jboss.spec:jboss-javaee-6.0:pom::3.0.2.Final and org.hibernate:hibernate-entitymanager:::4.2.0.Final)
3) generate-entities configure-settings --dialect org.hibernate.dialect.MySQLDialect --driver com.mysql.jdbc.Driver --url jdbc:mysql://*******:3306/******_db --pathToDriver /home/****/server_runtime_jboss/jboss-as-7.1.1.Final/modules/com/mysql/main/mysql-connector-java-5.1.24.jar --user *** --password ****
4) scaffold setup --scaffoldType faces;
5) richfaces setup
6) scaffold from-entity org.forgetest.model.* --overwrite;
For example look at the entity GeoCities
-----------------------------------------
CREATE TABLE IF NOT EXISTS `db`.`geo_cities` (
`city_iso_code` VARCHAR(5) NOT NULL ,
`city_text` VARCHAR(110) NULL ,
`isoCodeRegione` VARCHAR(5) NOT NULL ,
`geo_latitude` VARCHAR(45) NULL ,
`geo_longitude` VARCHAR(45) NULL ,
PRIMARY KEY (`city_iso_code`) ,
INDEX `fk_geo_citta_geo_regioni1_idx` (`isoCodeRegion` ASC) ,
CONSTRAINT `fk_geo_citta_geo_regioni1`
FOREIGN KEY (`isoCodeRegion` )
REFERENCES `db`.`geo_regions` (`region_iso_code` )
)
ENGINE = InnoDB;
-----------------------------------------
after generate-entities have :
-----------------------------------------
@Entity
@Table(name = "geo_cities")
public class GeoCities implements java.io.Serializable
{
private String cityIsoCode;
[...]
@Id
@Column(name = "city_iso_code", unique = true, nullable = false, length = 5)
public String getCityIsoCode()
{
return this.cityIsoCode;
}
-----------------------------------------
and this a snippet of the relative bean
-----------------------------------------
@Named
@Stateful
@ConversationScoped
public class GeoCitiesBean implements Serializable
{
private static final long serialVersionUID = 1L;
/*
* Support creating and retrieving GeoCities entities
*/
private Long id;
public Long getId()
{
return this.id;
}
--------------------------------------------
And after the deploy there isn't any field relative to the ISO code when i try to add a city...
i hope that is useful!
was (Author: reskejal):
I'll try to describe my scenario.
First i have designed a DB with MySql Workbench.
Then i create a project through forge with this sequence of commands
1) new-project --named forgetest --topLevelPackage org.forgetest
2) persistence setup --provider HIBERNATE --container JBOSS_AS7 ; (and choosed org.jboss.spec:jboss-javaee-6.0:pom::3.0.2.Final and org.hibernate:hibernate-entitymanager:::4.2.0.Final)
3) generate-entities configure-settings --dialect org.hibernate.dialect.MySQLDialect --driver com.mysql.jdbc.Driver --url jdbc:mysql://*******:3306/******_db --pathToDriver /home/****/server_runtime_jboss/jboss-as-7.1.1.Final/modules/com/mysql/main/mysql-connector-java-5.1.24.jar --user *** --password ****
4) scaffold setup --scaffoldType faces;
5) richfaces setup
6) scaffold from-entity org.forgetest.model.* --overwrite;
For example look at the entity GeoCities
-----------------------------------------
CREATE TABLE IF NOT EXISTS `db`.`geo_cities` (
`city_iso_code` VARCHAR(5) NOT NULL ,
`city_text` VARCHAR(110) NULL ,
`isoCodeRegione` VARCHAR(5) NOT NULL ,
`geo_latitude` VARCHAR(45) NULL ,
`geo_longitude` VARCHAR(45) NULL ,
PRIMARY KEY (`city_iso_code`) ,
INDEX `fk_geo_citta_geo_regioni1_idx` (`isoCodeRegion` ASC) ,
CONSTRAINT `fk_geo_citta_geo_regioni1`
FOREIGN KEY (`isoCodeRegion` )
REFERENCES `db`.`geo_regions` (`region_iso_code` )
)
ENGINE = InnoDB;
-----------------------------------------
after generate-entities have :
-----------------------------------------
@Entity
@Table(name = "geo_cities")
public class GeoCities implements java.io.Serializable
{
private String cityIsoCode;
[...]
@Id
@Column(name = "city_iso_code", unique = true, nullable = false, length = 5)
public String getCityIsoCode()
{
return this.cityIsoCode;
}
-----------------------------------------
and this a snippet of the relative bean
-----------------------------------------
@Named
@Stateful
@ConversationScoped
public class GeoCitiesBean implements Serializable
{
private static final long serialVersionUID = 1L;
/*
* Support creating and retrieving GeoCities entities
*/
private Long id;
public Long getId()
{
return this.id;
}
--------------------------------------------
And after the deploy there isn't any field relative to the ISO code when i tray to add a city...
i hope that is useful!
> 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: http://www.atlassian.com/software/jira
[View Less]
11 years, 11 months
[JBoss JIRA] (FORGE-572) Forge scaffold faces creates view beans with Id always Long against user-generated Entities
by George Gastaldi (JIRA)
[ https://issues.jboss.org/browse/FORGE-572?page=com.atlassian.jira.plugin.... ]
George Gastaldi commented on FORGE-572:
---------------------------------------
Claudio,
Could you provide a test case with your described scenario ?
Thanks
> Forge scaffold faces creates view beans with Id always Long against user-generated Entities
> -------------------------------------------------------------------------------------------
>
> Key: FORGE-572
…
[View More]> 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: http://www.atlassian.com/software/jira
[View Less]
11 years, 11 months
[JBoss JIRA] (FORGE-572) Forge scaffold faces creates view beans with Id always Long against user-generated Entities
by claudio perrotta (JIRA)
[ https://issues.jboss.org/browse/FORGE-572?page=com.atlassian.jira.plugin.... ]
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 More]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: http://www.atlassian.com/software/jira
[View Less]
11 years, 11 months