(E ai juliano, blz ?)

On Thu, 2002-08-29 at 14:29, Juliano Moraes wrote:
> Hi,
> I am using the tutorial 3 example of ojb for
> relationships n:m, but I am with a doubt. In the
> example I have 2 forms, with and without intermediate
> class. I made using the intermediate class (role) and
> it functioned. Now I do not using the intermediate
> class "role". Which object I have that to pass to the
> method "store", person or project?????

I'm not sure I understood your question, but.
If you call broker.store(person || project) and configure ojb to
auto-update then all references and collections your Object has will be
stored as well !

You can write to me in Portuguese if you want :-)

> 
> Thanks,
> Juliano Moraes
> ++++++++++++++++++
> www.qualita.inf.br
> ++++++++++++++++++
> 
> My source:
> 
> //package test.ojb.tutorial1;
> 
> import ojb.broker.PersistenceBroker;
> import ojb.broker.PersistenceBrokerException;
> import test.ojb.broker.*;
> /**
>  * Insert the type's description here.
>  * Creation date: (04.03.2001 10:34:15)
>  * @author: Administrator
>  */
> public class UCEnterNewRole1 extends AbstractUseCase
> {
>     /**
>      * UCEnterNewProduct constructor comment.
>      */
>     public UCEnterNewRole1(PersistenceBroker broker)
>     {
>         super(broker);
>     }
> 
>     /** perform this use case*/
>     public void apply()
>     {
>         
>         //Insert the Person
>         Person newPerson = new Person();
>         // now read in all relevant information and
> fill the new object:
>         System.out.println("please enter a new
> person");
>         
>         String in = readLineWithMessage("enter ID :");
>         newPerson.setId(Integer.parseInt(in));
>         in = readLineWithMessage("enter First name:");
>         newPerson.setFirstname(in);
>         in = readLineWithMessage("enter Last name:");
>         newPerson.setLastname(in);
>         
>         
>         //Insert the Project
>         Project newProject = new Project();
>         // now read in all relevant information and
> fill the new object:
>         System.out.println("please enter a new
> Project");
>         in = readLineWithMessage("enter ID :");
>         newProject.setId(Integer.parseInt(in));
>         in = readLineWithMessage("enter Title:");
>         newProject.setTitle(in);
>         in = readLineWithMessage("enter
> Description:");
>         newProject.setDescription(in);
>    
>    //HERE . WITH ROLE, OK.  
>    /*             
>         // this will be our new object
>         Role newRole = new Role();
>         // now read in all relevant information and
> fill the new object:
>         System.out.println("please enter a new Role
> (n:m)");
>         in = readLineWithMessage("enter PERSON_ID :");
>         newRole.setPerson_id(Integer.parseInt(in));
>         in = readLineWithMessage("enter PROJECT_ID
> :");
>         newRole.setProject_id(Integer.parseInt(in));
>         
>         in = readLineWithMessage("enter Role name:");
>         newRole.setRoleName(in);
>         
>         newRole.setProject(newProject);
>         newRole.setPerson(newPerson);
>    */     
> 
> 
>         // now perform persistence operations
>         try
>         {
>              // 1. open transaction
>             System.out.println("1");
>             broker.beginTransaction();
>             // 2. make the new object persistent
> HERE, what use?==>     broker.store(newProject);
>             System.out.println("3");
>             broker.commitTransaction();
>         }
>         catch (Exception ex)
>         {
>             System.out.println("ERRO ->"+ex);
>             
>             // if something went wrong: rollback
>             broker.abortTransaction();
>             System.out.println(ex.getMessage());
>             ex.printStackTrace();
>         }
>     }
> 
>     /** get descriptive information on use case*/
>     public String getDescription()
>     {
>         return "Enter a new Role (n:m) sem classe
> intermediaria";
>     }
> }
>  
> 
> _______________________________________________________________________
> Yahoo! PageBuilder
> O super editor para cria��o de sites: � gr�tis, f�cil e r�pido.
> http://br.geocities.yahoo.com/v/pb.html
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 
> 
-- 
Leandro Rodrigo Saad Cruz
IT - Inter Business Tecnologia e Servicos (IB)
http://www.ibnetwork.com.br
http://jakarta.apache.org/ojb


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to