• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Entity With Compound PK And CLOB Field
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Entity With Compound PK And CLOB Field


  • Subject: Re: Entity With Compound PK And CLOB Field
  • From: Chuck Hill <email@hidden>
  • Date: Tue, 24 May 2011 22:07:53 -0700

Hi Michael,

On May 24, 2011, at 8:43 PM, Michael Hast wrote:

> Hi:
>
> We had an interesting problem today. We have an entity called ReviewerData which has a personId and fiscalYear compound primary key. It also has 3 more attributes, a CLOB field, a varchar2(4000) and an Integer attribute. All attributes except the CLOB are marked as a locking attribute (see attached image).
>
> When we are updating the CLOB field and any of the other 2 attributes and call EC saveChanges, we are getting the error:
>
> Expected a LOB count of 0 but could not fetch that many objects.
>
> The issues is that there are 2 SQL statements being generated by the Oracle plugin within 1 transaction:
>
> UPDATE REVIEWER_DATA SET HAS_DONE_EXTERNAL_REVIEW = ?, REVIEW_QUALIFICATIONS = EMPTY_CLOB() WHERE (PERSON_ID = ? AND FISCAL_YEAR = ? AND DESCRIPTION_OF_WORK = ? AND HAS_DONE_EXTERNAL_REVIEW = ?) withBindings: 1:0, 2:97208, 3:2012, 4:"ABC", 5:1
>
> SELECT t0.REVIEW_QUALIFICATIONS FROM REVIEWER_DATA t0 WHERE (t0.PERSON_ID = ? AND t0.FISCAL_YEAR = ? AND t0.DESCRIPTION_OF_WORK = ? AND t0.HAS_DONE_EXTERNAL_REVIEW = ?) FOR UPDATE withBindings: 1:97208, 2:2012, 3:"ABC", 4:1

When you see "SELECT ... FOR UPDATE" that is often a sign that something has gone wrong in EOF (e.g. you have hit a bug).  In this case, however, I think it is just trying to update the CLOB.

>
> The SELECT statement fails, causing the error above. If I don't have a compound PK, only have a single PK attribute (personId), the SELECT statement only has one column in the where clause and all works great:
>
> SELECT t0.REVIEW_QUALIFICATIONS FROM REVIEWER_DATA t0 WHERE (t0.PERSON_ID = ?) FOR UPDATE withBindings: 1:97208
>
> I believe there is a bug in how the SQL is being generated. In the where clause it should only use the 2 PK attributes rather than all the lock attributes.
>
> My question is how can I fix this? Is it the Oracle plugin? Wonder has an Oracle plugin, should I try that out first?


I would try that first.  Second, you could move REVIEW_QUALIFICATIONS to its own table with a generated PK and a 1-1 relationship from Reviewer Data.  There is a good chance that would avoid the problem.


Chuck

--
Chuck Hill             Senior Consultant / VP Development

Come to WOWODC this July for unparalleled WO learning opportunities and real peer to peer problem solving!  Network, socialize, and enjoy a great cosmopolitan city.  See you there!  http://www.wocommunity.org/wowodc11/

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Entity With Compound PK And CLOB Field
      • From: Michael Hast <email@hidden>
    • Re: Entity With Compound PK And CLOB Field
      • From: Mike Schrag <email@hidden>
References: 
 >Entity With Compound PK And CLOB Field (From: Michael Hast <email@hidden>)

  • Prev by Date: Entity With Compound PK And CLOB Field
  • Next by Date: Re: Concurrent request handling
  • Previous by thread: Entity With Compound PK And CLOB Field
  • Next by thread: Re: Entity With Compound PK And CLOB Field
  • Index(es):
    • Date
    • Thread