Search code examples
mysqlspringjpaeclipselinkspring-roo

Weird behavior when persisting data using eclipselink and mysql


I'm developing a new application, my start point was Spring Roo, so I kind follow the same architecture that it does.

I have chosen eclipselink as my JPA implementation and MYSQL as my database.

The core of the application is a webcrawler that gather HTML from a specific website and process the HTML extracting some data from it, this extracted data is persisted with JPA entities.

All works fine in my development environment, the crawlers runs very fast and all data get's stored on the database.

But, when deployed on my test environment, which runs on top of amazon ec2 (using elastic beanstalk) and connects to a remote mysql server (a cheap hostgator plan as amazon RDS for testing is very expensive), the data gets messed up, actually not all the data, one specific field of one specific entity get's it's data all messed up.

The funniest thing is that I call the persist() method and right after use the same entity to send a notification email, and the email data is right, but when eclipselink (or the connector) sends the data do the database it stores some weird values, like:

456d207472c3a26e7369746f207061726120554e49444144452044452054524154414d454e544f20494e5445524e4143494f4e2e2e2e

It persists 1 value correctly and then 1 wrong.

Does anyone have experienced anything simmilar before?


Solution

  • I found this error by myself, it was related to encoding issues.

    I was browsing this data using phpmyadmin which doesn't support the kind of encoding plus database type I was using in my application.

    When I checked the data with a different client it was showing up right.

    The weird thing is that even on phpmyadmin only the rows that included special characters were showing wrongly