-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 13 posts ] 
Author Message
 Post subject: ManyToMany persistieren
PostPosted: Wed Jul 02, 2008 2:55 am 
Regular
Regular

Joined: Tue Jun 03, 2008 1:12 pm
Posts: 84
Location: germany
siehe
manyToMany: join-table mit drei Entity-Beans?


Last edited by nimo23 on Wed Jul 09, 2008 7:42 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 02, 2008 4:35 am 
Regular
Regular

Joined: Wed Apr 09, 2008 10:28 am
Posts: 52
Die Rollen Klasse muss soweit ich weiss auch das Serializable Interface Implementieren.
Wie werden die Id's in der Rollen Klasse gehandhabt? bzw. wieso benutzt du keine automatische Generierung dort wie in Person?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 02, 2008 8:06 am 
Regular
Regular

Joined: Tue Jun 03, 2008 1:12 pm
Posts: 84
Location: germany
siehe
manyToMany: join-table mit drei Entity-Beans?


Last edited by nimo23 on Wed Jul 09, 2008 7:42 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 02, 2008 8:42 am 
Regular
Regular

Joined: Wed Apr 09, 2008 10:28 am
Posts: 52
lass dir korrekte getter/setter zu deinem id Attribut generieren.

die müssten so aussehen:

Code:
   /**
    * @return the idRoles
    */
   public Integer getIdRoles() {
      return idRoles;
   }

   /**
    * @param idRoles the idRoles to set
    */
   public void setIdRoles(Integer idRoles) {
      this.idRoles = idRoles;
   }


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 02, 2008 9:07 am 
Regular
Regular

Joined: Tue Jun 03, 2008 1:12 pm
Posts: 84
Location: germany
siehe
manyToMany: join-table mit drei Entity-Beans?


Last edited by nimo23 on Wed Jul 09, 2008 7:43 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 02, 2008 9:38 am 
Regular
Regular

Joined: Wed Apr 09, 2008 10:28 am
Posts: 52
rolesGUI ist sozusagen die Liste mit den Rollen ?
Wenn ja könntest du folgendermaßen z.B. vorgehen
Code:
for (Iterator iter = rolesGUI.iterator(); iter.hasNext();) {
           rolesGUI element = (rolesGUI) iter.next();
                roles.add(element);
       }


Ein andere Ansatz wäre es eine findby query anzulegen und die Rollen (wenn ich es richtig verstanden hab sind diese fest definiert und in de rDatenbank hinterlegt) bevor du sie zuordnest herrauszulesen.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 02, 2008 9:54 am 
Regular
Regular

Joined: Tue Jun 03, 2008 1:12 pm
Posts: 84
Location: germany
siehe
manyToMany: join-table mit drei Entity-Beans?


Last edited by nimo23 on Wed Jul 09, 2008 7:43 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 02, 2008 10:14 am 
Regular
Regular

Joined: Wed Apr 09, 2008 10:28 am
Posts: 52
So vielleicht?
Code:
for (Iterator iter = rolesGUI.iterator(); iter.hasNext();) {
           (SelectItem) element = ((SelectItem)) iter.next();
                roles.add(element);
       }


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 02, 2008 10:25 am 
Regular
Regular

Joined: Tue Jun 03, 2008 1:12 pm
Posts: 84
Location: germany
siehe
manyToMany: join-table mit drei Entity-Beans?


Last edited by nimo23 on Wed Jul 09, 2008 7:43 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 02, 2008 10:34 am 
Regular
Regular

Joined: Tue Jun 03, 2008 1:12 pm
Posts: 84
Location: germany
siehe
manyToMany: join-table mit drei Entity-Beans?


Last edited by nimo23 on Wed Jul 09, 2008 7:44 am, edited 2 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 02, 2008 10:36 am 
Regular
Regular

Joined: Wed Apr 09, 2008 10:28 am
Posts: 52
Du könntest den zweiten Parameter von find durch den Schleifenzähler ersetzten. Weiss aber nicht ob der erwartete Wert ein Integer sein muss?
So ungefähr -> Wenns nichts geht dann halt durch einen integer ersetzten.

Code:
for (Iterator iter = rolesGUI.iterator(); iter.hasNext();) {

Role element = entityManager.find(Role.class, iter);
roles.add(element);
       }



Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 02, 2008 10:43 am 
Regular
Regular

Joined: Tue Jun 03, 2008 1:12 pm
Posts: 84
Location: germany
ja das geht,

jedoch ist mein schleifenzähler ja nicht meine echte idRole sondern nur mein Schleifenzähler...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 02, 2008 4:39 pm 
Regular
Regular

Joined: Tue Jun 03, 2008 1:12 pm
Posts: 84
Location: germany
double


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 13 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.