Saturday, October 09, 2010

Moving from MySQL to Derby

Developing locally i wanted to move my Database from MySQL to Derby on my laptop. Since i use JPA Entities i thought it's an easy task just clicking some menus.

Unfortunately triing to create the Tables from Entities were not as easy as i hoped.

Constraints 'SQL101008073950601' and 'SQL101008073950600' have the same set of columns, which is not allowed.

This was the first Problem i had to fix. Since google (or any other search engine) is the developers best friend i found this bug information:
https://issues.apache.org/jira/browse/DERBY-789?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

This Link is also very informative:
https://forum.hibernate.org/viewtopic.php?f=1&t=998193

In the end it was this little Attribute in Column (unique = true)
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "hi_id", unique = true, nullable = false)
derby column, or type mapping 'VARCHAR(65535)' is not valid
I found this link:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1501
@Column(name = "hi_text", length = 65535)
I had to cut the length to 32000.

No comments: