4 Replies Latest reply on May 29, 2010 11:26 AM by FinFlex

    Object -> Flex -> BlazeDS -> MySQL

    FinFlex Level 1

      Is there any tutorial how to save data to mySql database. I have database connection and i can get records from the MySQL table but how do I save objects or variables to db? Any help?


      I have a remoting destinations and java classes set to listen blazeds but nothing happens when Im invoking create insert methods.


      I have searched help from web but all topics and tutorials shows how to invoke Java methods to get data but no help on this question.

        • 1. Re: Object -> Flex -> BlazeDS -> MySQL
          UbuntuPenguin Level 4

          Do you have an ORM layer , like hibernate , or the JPA ( java persistence "something").  That is what you generally use when you want to shove stuff into the db.

          • 2. Re: Object -> Flex -> BlazeDS -> MySQL
            FinFlex Level 1

            No I don't, what would be the best choise for this?

            • 3. Re: Object -> Flex -> BlazeDS -> MySQL
              UbuntuPenguin Level 4

              Um okay , so if you don't have an ORM layer , you would have to look up Hibernate or the JPA if you wanted one.  I use the JPA because it is stock.  With an IDE like Netbeans , you can point it to the database in question and have it autogenerate the objects.  But that make take some time and if you don't have it you would probably be better off using straight SQL to push the values of the received object into the database.  For example your java service would look something like this.  Mind you its been a while since I've done this , but you get the idea.


              //The Person person is what is received from your remote object call

              public void personService( Person person )


                 String  insertPersonString  = "INSERT INTO PERSONS (name, age) VALUES (?,?)";

                 PreparedStatement insertPerson = connection.prepareStatement(insertPersonString);


                 insertPerson.setParameter( 1 , person.age );

                 insertPerson.setParameter( 2 , person.name );





              If this post was helpful please mark it as such.

              • 4. Re: Object -> Flex -> BlazeDS -> MySQL
                FinFlex Level 1

                Thank you for the help. I got the idea.