manyToOne need assistance in changing the reference type in database.

2 messages Options
Embed this post
Permalink
shendel18

manyToOne need assistance in changing the reference type in database.

Reply Threaded More More options
Print post
Permalink
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 = 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..
mraible

Re: manyToOne need assistance in changing the reference type in database.

Reply Threaded More More options
Print post
Permalink
Please ask this question on the user mailing list, you're likely to get more people reading this question there.

Thanks,

Matt

On Thu, Aug 27, 2009 at 11:17 PM, shendel18 <[hidden email]> 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 = 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..

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]