Hmmm,
Are you sure the column name starts with a lowercase P ?
Your annotation starts with an uppercase
ParentReplica_id_001
but your sample data references lowercase
parentReplica_id_001
shendel18 wrote:
>
> Hello im new to appfuse 2.X and configuring a one to may relationship. I
> have created successfully the new two objects:
>
> replica object and replica_tables object
>
> The problem is when i put values on sample data to test if it will link my
> replica_table to its parent replica object. I'm getting an empty value.
>
> replica_table
> id description name
>
> parentReplica_001
> 1 replica_table test_001 desc 1 replica_table name 1
>
> 2 replica_table test_001 desc 2 replica_table name 2
>
>
>
> im expecting values in mysql like this one.
>
> replica_table
> id description name
>
> parentReplica_001
> 1 replica_table test_001 desc 1 replica_table name 1
>
> 2
> 2 replica_table test_001 desc 2 replica_table name 2
>
> 2
>
>
> Below is my code..
>
> ----------------------------- Replica
>
> @Entity @Table(name="replica")
> public class Replica extends BaseObject {
> private Long id;
> private String name;
> private String description;
>
> public Replica() {}
>
> @Id @GeneratedValue(strategy = GenerationType.AUTO)
> public Long getId() {
> return id;
> }
>
> public void setId(Long id) {
> this.id = id;
> }
>
> @Column(name="name", length=50)
> public String getName() {
> return name;
> }
>
> public void setName(String name) {
> this.name = name;
> }
>
> @Column(name="description", length=50)
> public String getDescription() {
> return description;
> }
>
> public void setDescription(String description) {
> this.description = description;
> }
>
> @OneToMany (mappedBy="parentReplica_001")
> private Set<ReplicaTables> replica_tables = new HashSet();
>
> etc...
>
> -----------------------------
>
>
> ----------------------------- Replica table object
>
> @Entity @Table(name="replica_tables")
> public class ReplicaTables extends BaseObject {
> private Long id;
> private String name;
> private String description;
>
> public ReplicaTables() {}
>
>
> @Column(name="name", length=50)
> public String getName() {
> return name;
> }
>
> public void setName(String name) {
> this.name = name;
> }
>
> @Column(name="description", length=50)
> public String getDescription() {
> return description;
> }
>
> public void setDescription(String description) {
> this.description = description;
> }
>
> @Id @GeneratedValue(strategy = GenerationType.AUTO)
> public Long getId() {
> return id;
> }
>
> public void setId(Long id) {
> this.id = id;
> }
>
> @ManyToOne
> @JoinColumn (name="ParentReplica_id_001", updatable = false,
> insertable = false)
> private Replica parentReplica_001;
>
> etc . . .
> --------------------------------
>
> ------------------------------- sample-data.xml
>
> <table name="replica">
> <column>id</column>
> <column>name</column>
> <column>description</column>
> <row>
> <value description="id">1</value>
> <value description="name">replica name 1</value>
> <value description="description">replica desc 1</value>
> </row>
> <row>
> <value description="id">2</value>
> <value description="name">replicate name 2</value>
> <value description="description">replicate desc 2</value>
> </row>
> </table>
>
> <table name="replica_tables">
> <column>id</column>
> <column>name</column>
> <column>description</column>
> <column>parentReplica_001</column>
> <row>
> <value description="id">1</value>
> <value description="name">replica_table name 1</value>
> <value description="description">replica_table test_001 desc
> 1</value>
> <value description="parentReplica_001">2</value>
> </row>
> <row>
> <value description="id">2</value>
> <value description="name">replicate_table2 name 2</value>
> <value description="description">replicate_table2 desc 2</value>
> <value description="parentReplica_001">2</value>
> </row>
> </table>
> ----------------------------
>
> Thanks in advance for the help. :)
>
--
View this message in context:
http://www.nabble.com/one-to-many-mapping-problem..-tp25146746s2369p25147293.html
Sent from the AppFuse - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]