Page 1 of 1

Unsuccessful: create table BLC_SKU_FULFILLMENT_FLAT_RATES

Posted: Tue Jul 31, 2012 12:32 pm
by gr211
Hi,

I moved to a MySQL backend with the following:
- running within Tomcat 7.0.29
- MySQL 5.25
- Hibernate dialect changed to MYSQLDialect

When starting the main site, upon creating the DDL for SkuImpl, the properties "fulfillmentFlatRates" fails
to be translated into working SQL:

Code: Select all

[ERROR] 18:11:35 SchemaExport - Unsuccessful: create table BLC_SKU_FULFILLMENT_FLAT_RATES (SKU_ID bigint not null, RATE decimal(19,5), FULFILLMENT_OPTION_ID tinyblob not null, primary key (SKU_ID, FULFILLMENT_OPTION_ID))


Blobs cannot (or at least should not) be used as (part of) PK with MySQL.

Seems the type is wrong because in the Map<FulfillmentOption, BigDecimal>, FulfillmentOption is mapped in hibernate as a SerializableType because (I think) both @MapKeyJoinColumn and @MapKeyColumn are being used at the same time, and @MapKeyColumn appears last. It looks like just @MapKeyJoinColumn should be there (@MapKeyColumn is for simple types).

Is anyone else having the same issue ?

Regards,

Romain

Re: Unsuccessful: create table BLC_SKU_FULFILLMENT_FLAT_RATES

Posted: Tue Jul 31, 2012 3:18 pm
by phillipuniverse
I'll just copy-paste the reply that I gave on another related thread at viewtopic.php?f=15&t=631&p=1940

Yes, this is definitely a bug and is being tracked at http://jira.broadleafcommerce.org/browse/BLC-607. This should be resolved either today or tomorrow; very high priority for us to get this fixed.

Re: Unsuccessful: create table BLC_SKU_FULFILLMENT_FLAT_RATES

Posted: Wed Aug 01, 2012 10:39 am
by phillipuniverse
Thanks again for reporting this. This issue has now been resolved. The underlying problem was the fact that Hibernate didn't know how to properly map the Map<FulfillmentOption, BigDecimal> since FulfillmentOption is not an actual entity; FulfillmentOptionImpl is. So the fix was to add a @MapKeyClass(FulfillmentOptionImpl.class) annotation which allows Hibernate to map everything correctly.

You are right, there is no need for @MapKeyColumn in this case and has been removed now that the mapping is functioning as desired.

This change is getting pushed now to develop and will be available as apart of the 2.0.0-SNAPSHOT build later today, and will be included in a new milestone release later this week.

Re: Unsuccessful: create table BLC_SKU_FULFILLMENT_FLAT_RATES

Posted: Wed Aug 01, 2012 2:29 pm
by aazzolini
Broadleaf version 2.0.0-M1-4 addresses this issue and has been published. Please modify your pom to use this version of Broadleaf and let me know if the issue persists or is fixed.

Thanks!

Re: Unsuccessful: create table BLC_SKU_FULFILLMENT_FLAT_RATES

Posted: Fri Aug 03, 2012 3:56 am
by gr211
It's indeed fixed. Thanks for being so quick in adressing this issue.