openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Sutter <kwsut...@gmail.com>
Subject Re: Critical issue (Blocker): missing fields in update statement
Date Wed, 07 Mar 2012 16:33:51 GMT
Hi,
None of your attachments came through, so I can't comment directly.  But, I
have a couple of observations...

You mention one Entity with 66 fields and 46 relationships.  And, another
Entity definition has 141 fields.  Really?  Are you trying to map to an
existing database schema?  If not, I would reconsider your object model
since these numbers sound a bit excessive.  Even if you are working with an
existing schema, is there any possibility of modifying the schema?  I'm not
saying that the number of attributes/relationships per Entity is the cause
of your issue.  But, I would say that complicated Entities like this will
also complicate your application development and test cycle.

I also have to ask whether you are using the EM.merge() method correctly?
Are the entities (Knw) detached from the persistence context?  And, that's
why you are merging them in?  FYI, normal updating of Entities while being
managed by an EntityManager (ie. persistence context) do not have to be
merged.  The changes just need to be committed to the database.  I just
wanted to clarify the proper, expected usage of the JPA programming model.

As far as why not all of the attributes are being processed, I have no
idea.  I would suggest turning on Trace and seeing if there any clues as to
why the processing is not completing as expected.

Good luck,
Kevin

On Mon, Mar 5, 2012 at 7:09 PM, Prabhat Sharma2 <prabhatsharma@in.ibm.com>wrote:

>
> Environment:
>
> OS: Windows XP
> IDE:  IBM Rational® Software Architect for WebSphere Software (Version:
> 8.0.3)
> WAS: 6.1
> OpenJPA:  1.2.2
>
>
> Thanks & Regards,
> Prabhat Sharma
> Onsite Technical Lead- RD Customer
> 3039 Cornwallis Road, Building 061, RTP,NC, 27709.
> Work: 9195330161,
> Email: prabhatsharma@in.ibm.com
>
>
>
>
> From:   Prabhat Sharma2/India/IBM
> To:     dev@openjpa.apache.org, dev-help@openjpa.apache.org
> Cc:     Umamaheswari Subramanian/India/IBM, Vasudevan
>            Mogan/India/IBM@IBMIN, Ashish Nema1/India/IBM@IBMIN, Peri
>            Sujata/India/IBM@IBMIN, Hariom Soni1/India/IBM@IBMIN
> Date:   03/05/2012 08:07 PM
> Subject:        Critical issue (Blocker): missing fields in update
> statement
>
>
> Hello Team,
>
> We have some problem while updating an entity via entityManager's update
> method (generated by RSA8.0.3).
>
> Environment:
> OS: Windows XP
> IDE:  IBM Rational® Software Architect for WebSphere Software (Version:
> 8.0.3)
> WAS: 6.1
>
>
> This entity has around 66 fields and  42  ManyToOne  & 4 OneToMany.
> relationships. While update, it is calling update for all relational
> entities.
>
> For one of the oneToMany relationship table KNA1  (attaching the entity),
> the update is not appending all fields of the entity and last field field
> value is appearing like  " (null) null]". This entity has around 141
> fields.
> Attaching the main entity (Knvv) which I am updating.
>
> [attachment "Knvv.java" deleted by Prabhat Sharma2/India/IBM]
> [attachment "KnvvPK.java" deleted by Prabhat Sharma2/India/IBM]
>
> Here is the entity which has OneToMany relationship.
>
>
>
> [attachment "Kna1.java" deleted by Prabhat Sharma2/India/IBM]
> [attachment "Kna1PK.java" deleted by Prabhat Sharma2/India/IBM]
>
>
> Attaching the error log.
>
> [attachment "ErrorLog.txt" deleted by Prabhat Sharma2/India/IBM]
>
> Attaching persistence.xml also.
>
> [attachment "persistence.xml" deleted by Prabhat Sharma2/India/IBM]
>
> Please help me resolving the issue.
>
>
> I am updating an entity by using the below entityManager:
>
> @Action(Action.ACTION_TYPE.UPDATE)
>        public String updateKnvv(Knvv knvv) throws Exception {
>                EntityManager em = getEntityManager();
>                try {
>                        em.getTransaction().begin();
>                        knvv = em.merge(knvv);
>                        em.getTransaction().commit();
>                } catch (Exception ex) {
>                        try {
>                                if (em.getTransaction().isActive()) {
>                                        em.getTransaction().rollback();
>                                }
>                        } catch (Exception e) {
>                                ex.printStackTrace();
>                                throw e;
>                        }
>                        throw ex;
>                } finally {
>                        em.close();
>                }
>                return "";
>        }
>
>
> Thanks & Regards,
> Prabhat Sharma
> Onsite Technical Lead- RD Customer
> 3039 Cornwallis Road, Building 061, RTP,NC, 27709.
> Work: 9195330161,
> Email: prabhatsharma@in.ibm.com
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message