[Building Sakai] Saving a site property in 2.8.x

Steve Swinsburg steve.swinsburg at gmail.com
Tue Nov 15 12:14:56 PST 2011


Hi Erik,
Could you raise this as a Jira? Something for us to look at for future support of 5.5 perhaps. 

Cheers,
Steve

Sent from my iPhone

On 16/11/2011, at 5:35, Erik Froese <erik.froese at gmail.com> wrote:

> I fixed it so I figured I'd report.
> 
> I downgraded MySQL from 5.5.10 to 5.1.59 and started from a fresh database.
> I was using mysql-connector-java-5.1.18.
> 
> Erik
> 
> On Mon, Nov 14, 2011 at 5:30 PM, Erik Froese <erik.froese at gmail.com> wrote:
>> I'm trying to save a property on a Site object in Sakai 2.8.x and I
>> think I'm running into a unicode problem.
>> 
>> First I set the property on a SiteEdit before it is sent through the
>> SiteService.
>> 
>> // sEdit is a SiteEdit Object
>> ResourcePropertiesEdit rp = sEdit.getPropertiesEdit();
>> rp.addProperty(STATE_SITE_ACCESS_SHOPPING_ALLOWED_FUNCTIONS,
>> StringUtils.join(allowedFunctions, "|"));
>> 
>> Later the sEdit is saved by calling SiteService.save(site). I'm
>> modifying the SiteAction class (yikes!) so its taking care of calling
>> save(sEdit)
>> 
>> What should happen is we should see a statement issued to MySQL like this:
>> insert into SAKAI_SITE_PROPERTY( SITE_ID, NAME, VALUE ) values
>> ("3b1c5adf-29b6-40b3-954f-a9f841a92411", "shopping-allowed-functions",
>> "annc.read|asn.read|calendar.read")
>> 
>> What I see instead is this:
>> 
>>  insert into SAKAI_SITE_PROPERTY( SITE_ID, NAME, VALUE ) values
>> (x'33623163356164662D323962362D343062332D393534662D613966383431613932343131',x'73746174655F736974655F6163636573735F73686F7070696E675F616C6C6F7765645F66756E6374696F6E73',x'616E6E632E726561647C61736E2E726561647C63616C656E6461722E72656164')
>> 
>> As far as I can tell this is caused by
>> BasicSqlService.prepareStatement setting the statement parameters
>> using setBytes.
>> 
>> This causes the constraint violation since the SITE_ID doesn't match
>> anything in SAKAI_SITE.
>> 
>> I see this in catalina.out
>> Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException:
>> Cannot add or update a child row: a foreign key constraint fails
>> (`sakai`.`sakai_site_property`, CONSTRAINT
>> `sakai_site_property_ibfk_1` FOREIGN KEY (`SITE_ID`) REFERENCES
>> `SAKAI_SITE` (`SITE_ID`))
>> 
>> Has anyone else run into this? Any pointers?
>> 
>> Thanks
>> 
>> Erik
>> 
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
> 
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"


More information about the sakai-dev mailing list