You can give the attribute any name that you like.  I have been including the
base object name on mine so once I start working on the action class and
have multiple ids represented, I can follow the same naming convention that
was established in the model.



shendel_18 wrote:
> 
> Hello im using appfuse 2, i need help on how to change the value type in
> database.
> 
> Example.
> 
> ManytoOne (Person many Address)
> each Address associated with a Person via a many-to-one relationship (in
> other words, each Address  is associated with exactly one Person)
> 
> Person person = new Person ();
> Address address = new Address ();
> 
> address.setParentPerson(person);
> 
> The parentPerson object of the Address is successfully save but the
> problem
> is that, the save object in database has the type value of tinyblob (which
> it saves the whole object) i expect it to be only ID that will be
> referencing to the person's ID in the table Person.. How can i save just
> the
> id of the person's id in the parentPerson column in the Address table.
> 
> 
> Here is my code in Address:
> 
> @Entity @Table(name="address")
> public class Address extends BaseObject {
>    private Long id;
>    private String gsID;
>    private String description;
> 
>    public Address() {}
> 
> 
>    @Column(name="gsID", length=50)
>    public String getGsID() {
>                return gsID;
>        }
> 
>        public void setGsID(String gsID) {
>                this.gsID = gsID;
>        }
> 
> 
>    @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 <http://this.id> = id;
>    }
> 
>    @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )
>    private Person parentPerson;
> 
>        public Person getParentPerson() {
>                return parentPerson;
>        }
> 
> 
>        public void setParentPerson(Person parentPerson) {
>                this.parentPerson = parentPerson;
>        }
> 
> 
> Can anyone assist me with my problem..
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
> For additional commands, e-mail: users-h...@appfuse.dev.java.net
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/manyToOne-need-assistance-in-changing-the-reference-type-in-database-%282%29-tp25185558s2369p25239349.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net

Reply via email to