Owner in ManyToMany Relationships

Hello all,
I need to create a many to many relation between some roles and some policies.
I do not want to cascade PERSIST, or REMOVE. So when creating the relation both the Policies and Roles involved are in the database.
Also the relation are done in a stand alone client, so the objects become dettached.
So this is the issue:
In the first case the Role entity is the owner.
On the client side:
role.getPolicies().add( policy );
remoteSessionBean.updateObject( role ); //executes remotely on the server.All is fine. The role/policy association in saved into the database.
Now if do:
policy.getRoles().add( role );
remoteSessionBean.updateObject( policy ); The relation is not created in the database :(.
If I make the policy object the owner of the manytomany then the two exemple are reversed: it works when updating the relation via policy, but it does not work when updated via role.
Is there any way to make it work both at the same time. The GUI allows the user to eiter add roles to a policy and then save the policy, or to add policy to a roles and then save the roles.
Thank you for your time,
- Ilie

The Hibernate documentation states that in a bidirectional relationship both entities need to be updated.
So the code should look somethig like:
role.getPolicies().add(  policy );
policy.getRoles().add( role );
remoteSessionBean.update( role );
remoteSessionBean.update( policy );Unless anyone has a better idea this is the only way...

Similar Messages

  • Problem with ejb 3.0 entity beans with manyToMany relationship

    Hello everyone!
    I am using struts 1.2.9 and java ee 5 sdk update 2 for my enterprise application. Besides others i have these entity beans Targetgroup.java and City.java, (i would upload file but i do not know how:)
    with manytomany relationship with join table.
    when user updates Targetgroup, by clicking on web page with checkboxes and textfields, struts dispatch action calls following method stateless bean:
    public void update(String firmId, String targetgroupId, String newGender, String newMinYearsOld, String newMaxYearsOld, String[] newCities) {
    TargetgroupPK pkForUpdate = new TargetgroupPK(targetgroupId, firmId);
    Targetgroup targetgroupForUpdate = find(pkForUpdate);
    targetgroupForUpdate.setGender(newGender);
    targetgroupForUpdate.setMinyearold(Integer.parseIn t(newMinYearsOld));
    targetgroupForUpdate.setMaxyearold(Integer.parseIn t(newMaxYearsOld));
    //pronalazenje gradva za koje je vezana ciljna grupa
    Collection<City> newCitiesCollection = new ArrayList<City>();
    for(int i = 0; i < newCities.length; i++){
    String tmp_city_name = newCities;
    City city_obj = cityFacade.find(tmp_city_name);
    newCitiesCollection.add(city_obj);
    targetgroupForUpdate.setCityidCollection(newCities Collection);
    parameter newCities represents names of cities which user checked on his update page. When the page is showen to him some cities are allready check because they were connected with Targetgruoup when it was created (targetgroup).
    this code throws following exception:
    [#|2007-07-26T12:13:36.993+0200|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.container.web|_Threa dID=16;_ThreadName=httpWorkerThread-8080-0;_RequestID=f79d9c50-86b0-4b6c-96ab-97956dfb39c1;|StandardWrapperValve[action]: Servlet.service() for servlet action threw exception
    javax.ejb.EJBException: Transaction aborted; nested exception is: javax.transaction.RollbackException: Transaction marked for rollback.
    javax.transaction.RollbackException: Transaction marked for rollback.
    at
    .com.sun.enterprise.web.connector.grizzly.WorkerTh read.run(WorkerThread.java:75)
    javax.ejb.EJBException: Transaction aborted; nested exception is: javax.transaction.RollbackException: Transaction marked for rollback.
    at com.sun.ejb.containers.BaseContainer.completeNewTx (BaseContainer.java:3659)
    at com.sun.ejb.containers.BaseContainer.postInvokeTx( BaseContainer.java:3431)
    at com.sun.ejb.containers.BaseContainer.postInvoke(Ba seContainer.java:1247)
    at com.sun.ejb.containers.EJBLocalObjectInvocationHan dler.invoke(EJBLocalObjectInvocationHandler.java:1 92)
    at com.sun.ejb.containers.EJBLocalObjectInvocationHan dlerDelegate.invoke(EJBLocalObjectInvocationHandle rDelegate.java:71)
    at $Proxy149.update(Unknown Source)
    at audiotel.sms.actions.backoffice.TargetgroupDispatc hAction.updateOrDelete(TargetgroupDispatchAction.j ava:132)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.struts.actions.DispatchAction.dispatchM ethod(DispatchAction.java:270)
    at org.apache.struts.actions.DispatchAction.execute(D ispatchAction.java:187)
    at org.apache.struts.action.RequestProcessor.processA ctionPerform(RequestProcessor.java:431)
    at org.apache.struts.action.RequestProcessor.process( RequestProcessor.java:236)
    at org.apache.struts.action.ActionServlet.process(Act ionServlet.java:1196)
    at org.apache.struts.action.ActionServlet.doPost(Acti onServlet.java:432)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:727)
    com.sun.enterprise.web.connector.grizzly.WorkerThr ead.run(WorkerThread.java:75)
    |#]
    exceprion is throwen ONLY when in parameter newCities are city names allready connected to Targetgroup. when NewCities contains names of
    City objects which are not connected to Targetgroup it works fine, but it's of no use for me, because user must be able to add or remove certian cities from relaionship with Targetgroup. I think it's because there are rows in join table that contain primary keys of city and targetgroup which are connected so perisistence manager cann't write them again.
    i thought it was going to figure it out by itself, and only update those rows.
    Does anyone know what is the problem and solution?
    Thanks! (forgive my spelling errors :)

    solved the problem!
    I moved code from sesion bean to struts action as follows:
    CityFacadeLocal cityFacade = lookupCityFacade();
    //prikupljanje novih podataka o ciljnoj grupi
    String newGender = ctf.getGender();
    String newMaxYears = ctf.getMaxyears();
    String newMinYears = ctf.getMinyears();
    String[] newSelectedCities = ctf.getSelectedCities();
    //niz imena gradova se prevodi u kolekcju objekata City
    Collection<City> newCitiesObjCollection = new Vector<City>();
    for(int i = 0; i < newSelectedCities.length; i++){
    String tmpCityName = newSelectedCities;
    City tmpCityObj = cityFacade.find(tmpCityName);
    newCitiesObjCollection.add(tmpCityObj);
    //setovanje novih podataka
    targetgroupForUD.setGender(newGender);
    targetgroupForUD.setMinyearold(Integer.parseInt(newMinYears));
    targetgroupForUD.setMaxyearold(Integer.parseInt(newMaxYears));
    targetgroupForUD.setCityidCollection(newCitiesObjCollection);
    //pozivanje update metdoe u session beany
    targetgroupFacade.edit(targetgroupForUD);
    //korisnik se vraca na stranu sa svim postojecim ciljnim grupama
    forward = mapping.findForward("backend.targetgroups");
    and now it works fine. I guess probelm was same transaction scope for Targetgroup and City entities. Now when they are separated it works.
    Thanks!

  • Update bidirectional ManyToMany relationship

    Hello,
    we have a bidirectional man-to-many relationship (User - Course).
    Now we want users to join courses. How to update the relationship correctly?
    If I do
    course.getUsers().add(user);
    entityManager.merge(course);The user is not updated. Also if a add course to the users course list but only merge the course.
    And if I do
    course.getUsers().add(user);
    user.getCourses().add(course);
    entityManager.merge(course);
    entityManager.merge(user);I get a duplicate key exception, because jpa tries to add the entry in the join table twice.
    How to do this right?
    thanks
    Dirk

    No, they are not managed by the jpa at this moment.
    They come from a jsf application, that have serialized the course (into a selectbox).
    So simply adding the user to the coures is not enough.
    I've tried merging both bevore adding, to get them managed. But this doesn't work too. (The user is in the courses user list, but the course not in the users courses list)
    Edited by: Freak.2k on Jun 12, 2009 9:34 AM

  • Problem in JPA ManyToMany relationship.

    Please look at
    [http://forums.sun.com/thread.jspa?threadID=5358105&tstart=30|http://forums.sun.com/thread.jspa?threadID=5358105&tstart=30]
    thanks.

    You could make a class called (for example) DegreeToSpecialization that would link a Degree to a Specialization (also why do you have specialization and specification?) and save those instead of having them separate.
    Also I suspect there's something other faulty with your design too, but I just had lunch so I can't wrap my brain around this just yet. burp

  • @ManyToMany using Composite Key

    I have searched this forum concerning this issue. While I see others with a similar question, I see very little on a possible solution. Here is my problem statement.
    Class 1: Document.java
    Class 2: Collection.java
    Class 3: CollectionType.java
    XRef Table: Document_Collection
    Relationships:
    A DocumentID may be inside many collections.
    A CollectionID may have many documents.
    The owner of the relationship is document.java.
    The collection table uses 3 fields for defining a Primary Key--Site, Name, and Date. The three fields are Strings.
    I am using a SEQUENCE table for generating the unique Ids for each of the primary keys, except the Collection Table. This table is using a CompositePK Class for the Primary Key for the Collection Table.
    Document.java:
    @ManyToMany(cascade={CascadeType.ALL})
    @JoinTable(name="DOCUMENT_COLLECTION",
                      joinColumns=@JoinColumn(name="DC_DOCUMENT_ID",           referencedColumnName="DOCUMENT_ID"),
           inverseJoinColumns={@JoinColumn(name="DC_COLLECTION_ID", referencedColumnName="SITE_ID"),
                                        @JoinColumn(name="DC_COLLECTION_ID", referencedColumnName="NAME"),
                  @JoinColumn(name="DC_COLLECTION_ID", referencedColumnName="GROUP_DATE")}
    public Set<Collection> getCollectionSet() {
              return collectionSet;
    }Collection.java
    @ManyToMany(mappedBy="collectionSet")
    public Set<Document> getDocumentSet() {
         return documentSet;
    }In the Collection Class it holds a reference to a Collection type.
    CollectionType.java
    @Id
    @TableGenerator(name="COLLECTION_TYPE_TBL_GEN",
                   table="SEQUENCE",
                   pkColumnName="SEQ_NAME",
                   valueColumnName="SEQ_COUNT",
                   pkColumnValue="COLLECTION_TYPE_SEQ")
    @GeneratedValue(strategy=GenerationType.TABLE,     generator="COLLECTION_TYPE_TBL_GEN")
    @Column(name="COLLECTION_TYPE_ID", nullable=false)
    public Long getCollectionTypeId() {
         return collectionTypeId;
    }My test application builds the relationship for all the tables, and then attempts to persist the information to the database. When I look at at the log files, I see no errors, but the data is not being populated in the database. When I look at the SEQUENCE Table, I see all entries in the table are being incremented correctly except the Collection_Type sequence--still set to 1. I surmised the Collection Set for the Document_Collection table is not being populated correctly.
    My intent is to let TopLink generate the PK, Ids for the objects. This appears to be happening for the one-to-one relationships but not for the ManyToMany relationships. When I build the relationships, I create the collection and CollectionType and add it to a set. This set is added to the Document class. Lastly, I call the persist method on the Entity Manager. The log file shows the sequence number is being generated except for the Collection_Type Sequence. This may not be the correct way, but I did not see the correct steps for accomplishing this operation.
    [#|2007-08-27T16:52:03.899-0500|FINE|sun-appserver-pe9.0|oracle.toplink.essentials.file:/C:/glassfish/domains/domain1/applications/j2ee-apps/MyProject/MyEJB_jar/-MYEJBPU.sql|_ThreadID=12;_ThreadName=httpWorkerThread-8080-0;ClassName=null;MethodName=null;_RequestID=22dc7e71-9cef-4824-920f-5b3a2464c1d9;|SELECT SEQ_COUNT FROM SEQUENCE WHERE SEQ_NAME = ?
         bind => [URGENCY_SEQ]|#]This is how I build the Document Entity.
    @TransactionAttribute(TransactionAttributeType.REQUIRED)
    public Document addDocument(Document docVO) {
              entityManager.joinTransaction();
              Document doc = new Document();
              DataType dataType = getDataType(docVO.getDataType().getDescription());
              UrgencyIndicator urgency  = getUrgencyIndicator(docVO.getUrgencyIndicator().getCode());
              DocMetaData metadata = getDocMetadata(docVO.getDocMetadata().getStoragePath());
              WeaponsSystem weaponsSys = getWeaponsSystem(docVO.getWeaponsSystem().getCode());
              FileType fileType = getFileType(docVO.getFileType().getExtension());
              Date sqlDate = new Date(new java.util.Date().getTime());
              Set<Collection> collectSet = getDocumentCollection("Site", "Name", sqlDate.toString());
              doc.setUrgencyIndicator(urgency);
              doc.setDocMetadata(metadata);
              doc.setFileType(fileType);
              doc.setWeaponsSystem(weaponsSys);
              doc.setDataType(dataType);
              doc.setCollectionSet(collectSet);
              entityManager.persist(doc);
              return doc;
    }Any suggestions would be greatly appreciated.
    Russ

    Okay I figured out one of my problems. When you search using the EntityManager's find method, a null is returned should JPA not be able to find an entity. This led to not populating the Collection Type and Collection incorrectly....... Now all Sequence generators are working correctly....... However, I am still not storing information in the database. Grrrrrr

  • Bidirectional many to many relationship ...

    Hello Friends !
    I want to mapp 2 tables in a bidirectional many to many relationship. kindly help me how can i mapp them. Do i need just LIST collection on both sides or there is something more to do.
    in entity class 1
    @ManyToMany
    private List<Entity1> OneList = new ArrayList<Entity1>();
    in Entity class 2
    @ManyToMany
    private List<Entity2> TwoList = new ArrayList<Entity2>();
    Thanks in advance
    Regards,
    Zeeshan

    Zeeshan
         Hi, For a bidirectional @ManyToMany mapping without a @JoinTable specified - you must specify which side is the owning side so that we know who is the owner of the relationship and optionally the fetchType (fetch).
    You may refer to the following tutorial that contains a bidirectional @ManyToMany from an entity to itself in my case (same principle for different entity classes).
         I arbitrarily chose one side (references) to be the owning relationship (specifies the mapping) and the other (peers) to be the inverse side - where the "mappedBy" attribute is specified that targets the owning side.
    You may use any collection for the type depending on your schema - such as whether you allow duplicates etc.. - I return a Set<Cell> collection.
    http://wiki.eclipse.org/EclipseLink/Examples/JPA/WebLogic_Web_Tutorial
    http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/org.eclipse.persistence.example.jpa.server.weblogic.enterpriseEJB/ejbModule/org/eclipse/persistence/example/jpa/server/business/Cell.java
    // inverse relationship
    // m-m and 1-m do not weave by default
    @ManyToMany(mappedBy="references", fetch=FetchType.EAGER)
    private Set<Cell> peers;
    // owning relationship
    @ManyToMany(fetch=FetchType.EAGER)
    private Set<Cell> references;
    See also p.101-102 of the book "Pro EJB 3"
    http://books.google.com/books?id=fVCuB_Xq3pAC&printsec=frontcover&dq=pro+ejb3#PPA101,M1
    http://www.amazon.com/Pro-EJB-Java-Persistence-API/dp/1590596455
    thank you
    /michael
    www.eclipselink.org

  • JPA and @ManyToMany with Association Class

    Hi!
    I need to create a @ManyToMany relationship with another field in relation table besides the primary keys of the two main tables. How can I do that? I'm using Toplink Essentials.
    Thanks.

    ManyToMany relationships having an attribute can be modeled by an extra object, e.g.:
    Assuming A has a ManyToMany relationship to B. Introduce an object, say AB, having:
    * the extra attribute xyz
    * a ManyToOne relationship A, ie. A is the "one" side, AB owns the relationship
    * a ManyToOne relationship to B, ie. B is the "one" side, AB owns the relationship
    * AB's primary key would be the conbination of the foreign keys to A and B

  • New User Question : Many to Many relationship Association

    Hi
    I am trying to code a many to many relationship between two entities. One of my entity is named View and the other is Column.
    I am trying to use the @JoinTable annotation and for the table property in the annotation I am specifying a table column_view (which I have created in the database).
    My associative table has other fields, apart from the primary key of view and column entities. This makes me feel that my current way of using @JoinTable would not work under this condition and I have to create two onetomany mappings like
    Column -> OnetoMany -> ColumnView <- OnetoMany <- View.
    Am I right in my approach or is there anyother way out to represent such manytomany relationships.

    Why other fields are required in your relationshipt table?
    have only two columns and perform @ManyToMany.
    @JoinTable has to be used only on owning side.
    user (mappedBy ) on the other side
    thanks

  • ManyToOne relationship with extra field in the joinTable

    Hi,
    I wanted to make a ManyToMany unidirectional relationship using these two entities.
    Invoice (id)
    Product (id, price)
    The problem is that I want in the resulting joinTable another field named QUANTITY
    I don’t think there is a way to obtain a join table with an extra field from a ManyToMany relationship, am I right ?
    Si I decided to add an InvoiceLine table
    With Invoice and InvoiceLine tables having a OneToMany unidirectional relationship.
    And InvoiceLine and Product tables having a ManyToOne unidirectional relationship.
    This is the code I made
    import java.util.Set;
    import java.util.HashSet;
    import javax.persistence.*;
    @Entity
    public class Invoice implements java.io.Serializable {
         private long id;
         private Set<InvoiceLine> InvoiceLines = new HashSet<InvoiceLine>();
         @Id
         @GeneratedValue
         public long getId() {
              return id;
         public void setId(long id) {
              this.id = id;
         @OneToMany(cascade={CascadeType.ALL})
         @JoinColumn(name="INVOICE_ID")
         public Set<InvoiceLine> getInvoiceLines() {
              return InvoiceLines;
         public void setInvoiceLines(Set<InvoiceLine> InvoiceLines) {
              this.InvoiceLines = InvoiceLines;
    import javax.persistence.*;
    @Entity
    public class InvoiceLine implements java.io.Serializable {
         private long id;
         private Product product;
         private int quantity;
         @Id
         @GeneratedValue
         public long getId() {
              return id;
         public void setId(long id) {
              this.id = id;
         @ManyToOne
         public Product getProduct() {
              return product;
         public void setProduct(Product product) {
              this.product = product;
         public int getQuantity() {
              return quantity;
         public void setQuantity(int quantity) {
              this.quantity = quantity;
    import javax.persistence.*;
    @Entity
    public class Product implements java.io.Serializable {
         private long id;
         private double price;
         public Product() {
         public Product(double price) {
              this.price = price;
         @Id
         @GeneratedValue
         public long getId() {
              return id;
         public void setId(long id) {
              this.id = id;
         public double getPrice() {
              return price;
         public void setPrice(double price) {
              this.price = price;
    }The problem is that I want the InvoiceLine table to have a composite primary key (from the two foreign keys in the table invoice_id and product_id).
    Can anyone tell me how I can do this.
    Thanks.
    Edited by: Exhortae on Jun 23, 2009 4:59 PM
    Edited by: Exhortae on Jun 23, 2009 5:01 PM

    Hello,
    If we create a Z report for this program, can anyone please tell me where can I find the function "REUSE_ALV_GRID_DISPLAY" in the given program so that I can add my fields along with the default filelds displayed...
    Thanks
    ~Him

  • ManyToMany persist entity problem

    Hi, I'm beginning with EJB 3.0 and I've wrote this code to persist data from two tables, whitch have ManyToMany relationship.
    When I want to persist objects I gives me a error... How to reduce this problem?
    Thanks!!!
    Entity #1:
    @Entity
    @Table(name = "kategorie")
    @NamedQueries({@NamedQuery(name = "Kategorie.findById", query = "SELECT k FROM Kategorie k WHERE k.id = :id"), @NamedQuery(name = "Kategorie.findByNazev", query = "SELECT k FROM Kategorie k WHERE k.nazev = :nazev")})
    public class Kategorie implements Serializable {
        private static final long serialVersionUID = 1L;
        @Id
        @GeneratedValue
        @Column(name = "id", nullable = false)
        private Integer id;
        @Column(name = "nazev")
        private String nazev;
        @JoinTable(name = "kategorieprodukty",
                   joinColumns = {@JoinColumn(name = "kategorie", referencedColumnName = "id")},
                   inverseJoinColumns = {@JoinColumn(name = "produkt", referencedColumnName = "id")})
        @ManyToMany
        private Collection<Produkty> produktCollection;
        public Kategorie() {
        public Kategorie(Integer id) {
            this.id = id;
        public Integer getId() {
            return id;
        public void setId(Integer id) {
            this.id = id;
        public String getNazev() {
            return nazev;
        public void setNazev(String nazev) {
            this.nazev = nazev;
        public Collection<Produkty> getProduktCollection() {
            return produktCollection;
        public void setProduktCollection(Collection<Produkty> produktCollection) {
            this.produktCollection = produktCollection;
        public void addProdukt(Produkty produkt) {
            this.getProduktCollection().add(produkt);
        }Entity #2:
    @Entity
    @Table(name = "produkty")
    @NamedQueries({@NamedQuery(name = "Produkty.findById", query = "SELECT p FROM Produkty p WHERE p.id = :id"), @NamedQuery(name = "Produkty.findByNazev", query = "SELECT p FROM Produkty p WHERE p.nazev = :nazev")})
    public class Produkty implements Serializable {
        private static final long serialVersionUID = 1L;
        @Id
        @Column(name = "id", nullable = false)
        private Integer id;
        @Column(name = "nazev")
        private String nazev;
        @Lob
        @Column(name = "popis")
        private String popis;
        @ManyToMany(mappedBy = "produktCollection")
        private Collection<Kategorie> kategorieCollection;
        public Produkty() {
        public Produkty(Integer id) {
            this.id = id;
        public Integer getId() {
            return id;
        public void setId(Integer id) {
            this.id = id;
        public String getNazev() {
            return nazev;
        public void setNazev(String nazev) {
            this.nazev = nazev;
        public String getPopis() {
            return popis;
        public void setPopis(String popis) {
            this.popis = popis;
        public Collection<Kategorie> getKategorieCollection() {
            return kategorieCollection;
        public void setKategorieCollection(Collection<Kategorie> kategorieCollection) {
            this.kategorieCollection = kategorieCollection;
        }Session Bean:
    @Stateless
    public class ProduktyFacade implements ProduktyFacadeRemote {
        @PersistenceContext
        private EntityManager em;
        public void create(Produkty produkt, Collection<Kategorie> kategorie)
            em.persist(produkt);
            em.refresh(produkt);
            for (Kategorie kat : kategorie) {
                kat.addProdukt(produkt);
        public void edit(Produkty produkty) {
            em.merge(produkty);
        public void remove(Produkty produkty) {
            em.remove(em.merge(produkty));
        public Produkty find(Object id) {
            return em.find(domain.Produkty.class, id);
        public List<Produkty> findAll() {
            return em.createQuery("select object(o) from Produkty as o").getResultList();
    }When I call:
    @EJB
        private ProduktyFacadeRemote produktyFacade;
    produkt = new Produkty();
    Collection<Kategorie> kategorie = new ArrayList<Kategorie>();
    kategorie.add(...
    produktyFacade.create(produkt, kategorie);
    ...It gives me this error (I'm using Netbeans 6.0.1 with GlassFish V2):
    "IOP00810257: (MARSHAL) Could not load class domain.Kategorie"
    org.omg.CORBA.MARSHAL:   vmcid: SUN  minor code: 257 completed: Maybe
            at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:9684)
            at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:9699)
            at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1042)
            at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:896)
            at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_abstract_interface(CDRInputStream_1_0.java:890)
            at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_abstract_interface(CDRInputStream_1_0.java:880)
            at com.sun.corba.ee.impl.encoding.CDRInputStream.read_abstract_interface(CDRInputStream.java:511)
            at com.sun.corba.ee.impl.io.IIOPInputStream.readObjectDelegate(IIOPInputStream.java:386)
            at com.sun.corba.ee.impl.io.IIOPInputStream.readObjectOverride(IIOPInputStream.java:547)
            at java.io.ObjectInputStream.readObject(ObjectInputStream.java:345)
            at java.util.ArrayList.readObject(ArrayList.java:593)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at com.sun.corba.ee.impl.io.IIOPInputStream.invokeObjectReader(IIOPInputStream.java:1679)
            at com.sun.corba.ee.impl.io.IIOPInputStream.inputObject(IIOPInputStream.java:1202)
            at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:422)
            at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.java:362)
            at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:328)
            at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:966)
            at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1052)
            at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:475)
            at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl$14.read(DynamicMethodMarshallerImpl.java:368)
            at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl.readArguments(DynamicMethodMarshallerImpl.java:435)
            at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:152)
            at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:687)
            at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:227)
            at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1846)
            at com.sun.corba.ee.impl.protocol.SharedCDRClientRequestDispatcherImpl.marshalingComplete(SharedCDRClientRequestDispatcherImpl.java:183)
            at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.invoke(CorbaClientDelegateImpl.java:219)
            at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:192)
            at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:152)
            at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(BCELStubBase.java:225)
            at session.__ProduktyFacadeRemote_Remote_DynamicStub.create(session/__ProduktyFacadeRemote_Remote_DynamicStub.java)
            at session._ProduktyFacadeRemote_Wrapper.create(session/_ProduktyFacadeRemote_Wrapper.java)
            at jsf.ProduktyController.create(ProduktyController.java:62)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at com.sun.el.parser.AstValue.invoke(AstValue.java:187)
            at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
            at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
            at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
            at javax.faces.component.UICommand.broadcast(UICommand.java:383)
            at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:447)
            at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
            at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
            at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
            at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
            at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
            at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
            at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
            at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
            at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
            at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
            at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
            at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
            at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
            at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
            at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
            at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
            at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
            at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
    nested exception is: java.rmi.MarshalException: CORBA MARSHAL 1398079745 Maybe; nested exception is: org.omg.CORBA.MARSHAL: ----------BEGIN server-side stack trace---------- org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 257 completed: Maybe at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:9684) at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:9699) at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1042) at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:896) at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_abstract_interface(CDRInputStream_1_0.java:890) at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_abstract_interface(CDRInputStream_1_0.java:880) at com.sun.corba.ee.impl.encoding.CDRInputStream.read_abstract_interface(CDRInputStream.java:511) at com.sun.corba.ee.impl.io.IIOPInputStream.readObjectDelegate(IIOPInputStream.java:386) at com.sun.corba.ee.impl.io.IIOPInputStream.readObjectOverride(IIOPInputStream.java:547) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:345) at java.util.ArrayList.readObject(ArrayList.java:593) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.sun.corba.ee.impl.io.IIOPInputStream.invokeObjectReader(IIOPInputStream.java:1679) at com.sun.corba.ee.impl.io.IIOPInputStream.inputObject(IIOPInputStream.java:1202) at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:422) at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.java:362) at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:328) at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:966) at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1052) at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:475) at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl$14.read(DynamicMethodMarshallerImpl.java:368) at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl.readArguments(DynamicMethodMarshallerImpl.java:435) at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:152) at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:687) at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:227) at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1846) at com.sun.corba.ee.impl.protocol.SharedCDRClientRequestDispatcherImpl.marshalingComplete(SharedCDRClientRequestDispatcherImpl.java:183) at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.invoke(CorbaClientDelegateImpl.java:219) at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:192) at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:152) at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(BCELStubBase.java:225) at session.__ProduktyFacadeRemote_Remote_DynamicStub.create(session/__ProduktyFacadeRemote_Remote_DynamicStub.java) at session._ProduktyFacadeRemote_Wrapper.create(session/_ProduktyFacadeRemote_Wrapper.java) at jsf.ProduktyController.create(ProduktyController.java:62) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.sun.el.parser.AstValue.invoke(AstValue.java:187) at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297) at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77) at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91) at javax.faces.component.UICommand.broadcast(UICommand.java:383) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:447) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752) at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97) at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244) at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214) at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265) at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106) ----------END server-side stack trace---------- vmcid: SUN minor code: 257 completed: Maybe

    Steve Edens wrote:
    I'm also trying to get a grip on the best way to handle some static application properties in a clustered environment. My need mostly relates to
    a need to read in some flat file type properties and then store them someplace
    where business logic can call them as needed.. Like a static hashmap or
    something. But someone mentioned Entity beans, BMP, etc..
    Now.. here's the strange part of the message.
    Back in 1999 I traveled over to our west coast office in San Francisco. I was meeting and greeting the staff there and along the way I had a short
    meeting with someone named Bisera Ferrero. I mention this event because I
    was really impressed with the beauty and charm of Bisera. Therefore, I guess
    I'm a fan. I rememered the name.. a little. Really, I had sort of forgotten
    about it until reading this forum this morning. So.. who knows. I guess
    there could be a lot of Bisera Ferrero names on our planet.
    Good luck in your quests..

  • I bought an iPhone 5 off of craigslist, which unbeknownstome was stolen

    Before I start, I just want to let everyone know that I know exactly what most of you will say, but I beg you to read this with an open-mind and understand where I'm coming from and my position. I am also a victim in this situation, just like the girl whose phone was stolen.
    I bought an iPhone 5 from somebody on Craigslist who told me it was his girlfriend's phone which he was selling. Prior to me buying it from him, I interogated the guy asking him all sort of different questions such as the reason he was selling the iPhone 5 and condition of the phone and the guarantee, etc. I wanted to make sure it was not a stolen phone or a messed up phone that was no working properly. I freshly remember it being a 10-minute conversation covering all of that,so I want to make clear, that I indeed had no idea it was a stolen phone.
    Now, as soon as I had bought the phone from the guy I went to a redpocket store to try and activate it with their nano sim card, and that's when I came across with the iCloud Activation Lock with a message which said something along the lines "This is a lost phone, please call me" with the number written down. As soon as I saw that, I called the guy who sold me the phone to ask him what the heck that was about, but he did not reply and that's when I realized I had been officially scammed. I contacted the original owner of the phone and we talked for hours comparing notes on the guy and sharing our story about how her phone was stolen and how I bought the phone from this guy etc. She told me she already had a new phone(iPhone 5S) but she still had a lot of photos on that phone and that she wants to see if she can recover it somehow so she wanted me to return it her phone and she would give me $100 recompense. When she offered that deal I was torn...cause I did not feel like it was a fair deal, but at the same time I wanted to help her. So I eventually made it clear that I wasn't too happy with that deal so she actually came up with a new one...
    "Give me $200 and you can keep the phone, but we would have to meet at an Apple store, that way I/they can make sure all my memory is wiped out"
    I don't know if it's just me, but it sounds too risky. Do you guys think she might try to pull one under me and try to stay with the phone without me getting something in return? God knows who she might show up with. Can she do that? When it comes down to it, I am not the person who stole her phone...like I said, I am a victim, just like her and all I wanted was to work something out which would be fair for the both of us. I could have easily sold it forward to another person for the same price I was scammed, but I didn't cause I don't do unto others what I don't want others to do unto me. So just think about that before you all yell at me saying "RETURN HER iPHONE BACK!!!!11111"
    So yea, this is basically a post for ideas and suggestions about what I should do.

    It's rare that Craigslist phone scam victims like yourself are able to identify or get in touch with the original owner.
    Given that you're in contact with the original owner and you both can identify the thief I think the police might be able to help in this situation. If the original owner is willing to file a police report about the stolen phone and you're willing to turn it in to the police then the distict attorney would have an "open and shut" case with the evidence (iPhone) and testimony of the proper original owner (victim) and testimony from the buyer (victim). Get her to put in writing a summary of the situation where she identifies you as a victim and identifies the thief. If you can get her to get that Affidavit notarized at a Notary Public then that protects you to some degree.
    Depending on the situation you might just get back in touch with the ex-boyfriend at that point and tell him point blank you have a legal notarized Affidavit identifying him as a thief and seller of stolen goods and you'll take it to the police and District Attorney if he doesn't refund your money in full. Then get your cash, return the phone to the proper owner, and then if she can get it reactivated buy it from her or take your cash elsewhere.
    If you and the gal go the police and present an open/shut case eventually the iPhone (evidence) will be returned to the gal after the boyfriend is convicted and if you're a party to the case you may get the judge to order compensation back to you of the amount of cash he stole from you via fraud. That's the ideal world, but remember we have a "legal system", not a "justice system" and anything can happen in court. I strongly suggest getting a notarized Affidavit from the gal identifying the thief and identifying you as a victim. That notarized document would provide the most protection for you in any way the situation unfolds. If the original owner reconciles her relationship with the boyfriend and declines to press charges against him then at least with the Affidavit the D.A. could proceed with that as her testimony and again protects you.

  • Mapping and relations in database ....

    Hello Friends,
    I'm a bit new to Toplink so i need your help. I am working with snort Rules.
    I have 5 tables in my datbase. one table is the parent table. Rules. The other tables are child tables. Addresses, Ports, Flags and values.
    I have a GUI interface from where i can inser a new Rule in the table - I have the primary key created by a sequence in each table. A rule contains everything .. i mean IP addresses, Ports, different Flag Values and some other variable values. Now i want to create relations between the tables.
    The rules table has one to many relationship with address address, ports and values table. And address table has many to one relationship with rules. Can anybody help me how can i create relationship between tables.
    I have written some code by but i am getting errors. The code is as follows.
    In rules table i have written this code.
    public class Rules implements Serializable {               
    @OneToMany
         (mappedBy="rules", targetEntity= Address.class, fetch=FetchType.EAGER )
         private Address address;
    Address table has a colum with SID as foreign key.
    public class Address implements Serializable {
    @ManyToOne(optional=false)
    @JoinColumn(name="SID",referencedColumnName="SID")
    private Rules rules;
    Kindly help me and let me know what is tha problem with this code.
    Many thanks in advance.

    If one Address can be in more than one Rule, then you do not have a OneToMany relationship, you have a ManyToMany relationship. So make both relationships a Collection and use the @ManyToMany annotation. You will also need to have a JoinTable for the relationship on the database, use a mappedBy on one side of the relationship.
    See,
    http://en.wikibooks.org/wiki/Java_Persistence/ManyToMany
    James : http://www.eclipselink.org

  • JPA  -  tree structure mapping    with toplink essential

    I'll try to explain it correctly.
    I store a tree structure in a database. I have just two tables:
    Node which contain a id , and some other info.
    Tree which contain a parent and child
    parent and child are ids from node.
    Since each node can have several childs, and each node can have several parents, I had try a @ManyToMany relationship without sucess.
    Here one small example of my tries :
    @Entity
    @Table(name="node")
    public class Node {
    @Id private int id;
    private List<Node> childs;
    private List<Node> parents;
    @ManyToMany
    @JoinTable(name="Tree")
    public List<Node> getParents(){
         return parents;
    @ManyToMany(mappedBy="parents")
    public List<Node> getChilds(){
         return childs;
    }But I always got several error.
    Anyone have a working example that look like mine ?
    Even after googling for several hours I still find nothing.
    If it helps, I use toplink essential for my persistance layer.

    Please see http://www.oracle.com/technetwork/middleware/toplink/index-085257.html for information on TopLink JPA support.
    So as of TopLink 11, you will need to use EclipseLink's org.eclipse.persistence.jpa.PersistenceProvider as the provider class for JPA support, which is in the eclipselink.jar.
    Best Regards,
    Chris

  • Lazy loading, EntityManager and concurrency.

    I need advice which strategy to use with lazy loading.
    My project is based on Spring, Struts 2 and Hibernate JPA. I have enough OneToMany and ManyToMany relationships and it's reasonable to use lazy loading. It seems very convenient to load data in Struts Actions with OpenEntityManagerInViewFilter in such way like:
    Style style = user.getStyle()
    But to avoid LazyLoadException I have to use:
    @PersistenceContext(type=PersistenceContextType.EXTENDED)
    Unfortunately, EntityManager in this case becomes not thread-safe, according to Spring docs: "+Extended EntityManagers are not thread-safe, hence they must not be used in concurrently accessed beans (which Spring-managed singletons usually are).+" EXTENDED means that EntityManager is shared in user session and my EntityManager is injected in singleton services.
    I've found this issue when tried to make quick sequential page reloading which call some selects and got:
    java.sql.SQLException: You can't operate on a closed Statement!!!
    What's the best practice in this situation:
    1. Try synchronize session access to EntityManager by myself or put each user database requests in separate queue (something terrible I suppose).
    2. Use HQL queries with join fetch to preload data for access outside of transaction (maybe overhead).
    3. Or something else???
    And why we need EXTENDED context if it's so unreliable??
    Thanks for help!

    Hi
    Do you have the link to the "lazy loading content"?
    I can't find a proper way to do it.
    Thanks

  • JPQL - Select

    Hi,
    I did not find any JPA related forum, so, I'll try here.
    I'm trying to create a named query like:
    SELECT DISTINCT d FROM District d, district_municipality md WHERE md.districtID = :id
    But this will complain about district_municipality as it is not an Entity. Is this possible to do without creating an entity type for district_municipality? Or is it possible to create a named query of native SQL? How do I do that?
    The following example native SQL works:
    SELECT DISTINCT * FROM district d, district_municipality md WHERE md.districtID = 1
    district_municipality is a relation table between district and municipality tables.
    Thanks,
    Mattias

    Why do you want to create a named query? Why not just execute a native query via entitiyManager.createNativeQuery. ? For you to be able to execute the query as JPQL query, all related tables must be mapped to entities.
    Alternatively, you could create entity classes district and municipality and map district as having a ManyToMany relationship to municipality, so you would have to operate with the relation table.

Maybe you are looking for

  • I am trying to create a print ready PDF from a word file with unacceptable results.

    I am trying to create a print ready PDF from a word file with unacceptable results. The word file has a trim size of 6" x 9". It has been set to mirror margins with the inner, top and bottom margins set to 0.75", the outer margin is set to 0.5" and t

  • Creating UDL file for use of HFMCopyApplication utility

    I'm trying to create the UDL file on the HFM server to link to the SQL database where HFM sits. I followed the instructions and created a new text document, rename it as extension .udl. According to the instruction, I'm supposed to double click on th

  • Why am I double charged for downloading premier elements 12?

    I downloaded from ADOBE last Thursday the version 12 of adobe premier elements and I am finding out this week that my card was charged twice for the same version of software....................Please help? this is not the ADOBE I know......is there s

  • QuickTime Problem. Doesn't play video.avi.

    I have updated the system up to the latest - Maverick. After that QuickTime Player doesn't play video.avi. I have tried restarting the app - worthless. Yet, it has been showing 'Converting' for 30 mins. Please, help!

  • Nikon NEF raw format files?

    Hi All, Upgraded to iTunes 9.1.0.79 yesterday. Tried to sync my v3.1.3 3GS and ran out of space because it appears that iTunes can now sync Nikon raw files (.nef files.) Does anyone know of a way to tell iTunes to ONLY sync my .jpg files and NOT the