I want to be able to show the id field (a primary key) of each entry in list.jspx and subsequently allow the user to enter their own id in create.jspx (down the road). Is this possible?
I want to be able to show the id field (a primary key) of each entry in list.jspx and subsequently allow the user to enter their own id in create.jspx (down the road). Is this possible?
The id field is not show on direct engineer (make with entity and field commands) because value is auto generated.
You can push-in the id property to your java class and remove the generated value annotation:
Regards !@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
private Long id;
Mario Martínez Sánchez
Project Manager & Software Architect
--------------------------
Disid Technologies S.L.
http://www.disid.com
--------------------------
gvNIX
http://gvnix.googlecode.com
http://www.gvnix.org
I have the following for a very simple test. This is in test.java. Roo did automatically delete what is in test_roo_jpa_entity.java and the code in DB_managed. However when I run it on the server only the name is shown in list.jspx, still no ID field.
Any further advice? Thank you very much.@RooJavaBean
@RooToString
@RooJpaActiveRecord(versionField = "", table = "test")
@RooDbManaged(automaticallyDelete = true)
public class Test {
@Id
@Column(name = "testId")
private Integer testId;
@Column(name = "name", length = 30)
private String name;
//Getter & Setter for testId
public Integer getTestId() {
return this.testId;
}
public void setTestId(Integer testId) {
this.testId = testId;
}
//Getter & Setter for Name
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
You have to add the id-column manually to list.jspx
e.g.
<table:column id="c_com_foo_bar_id" property="id" z="-1"/>
Mario Martínez Sánchez
Project Manager & Software Architect
--------------------------
Disid Technologies S.L.
http://www.disid.com
--------------------------
gvNIX
http://gvnix.googlecode.com
http://www.gvnix.org
When I type the following into list.jspx
I get an internal error. and that "No message found under code 'label_com_mtc_test_test_testid' for locale 'en_US'". The id field I am trying to show is called testId.<table:column id="c_com_mtc_test_Test_testId" property="testId" z="-1"/>
Last edited by ericmc; Jul 2nd, 2012 at 08:08 AM.
You have to add the message key 'label_com_mtc_test_test_testid' in your application.properties
Mario Martínez Sánchez
Project Manager & Software Architect
--------------------------
Disid Technologies S.L.
http://www.disid.com
--------------------------
gvNIX
http://gvnix.googlecode.com
http://www.gvnix.org