Page 1 of 4

Migrating from in memory database to MySQL Broadleaf 2.0

Posted: Mon Jul 30, 2012 3:05 am
by saman
Hi everyone,

I have downloaded, build and successfully run the demo project (heat clinic) comes with Broadleaf verion 2.0. But it is in-memory database and I wanted to migrate it into MySQL database. I changed the datasource and dependency changes to MySQL as described in the wiki page. But I encountered following exception. Have anyone experience this and fix the issue.

[artifact:mvn] [ INFO] 12:48:00 SchemaExport - exporting generated schema to database
[artifact:mvn] [ERROR] 12:48:01 SchemaExport - Unsuccessful: create table BLC_CATEGORY (CATEGORY_ID bigint not null, ACTIVE_END_DATE timestamp, ACTIVE
_START_DATE timestamp, ARCHIVED char(255), DESCRIPTION varchar(255), DISPLAY_TEMPLATE varchar(255), LONG_DESCRIPTION clob, NAME varchar(255) not null,
URL varchar(255), URL_KEY varchar(255), DEFAULT_PARENT_CATEGORY_ID bigint, primary key (CATEGORY_ID))
[artifact:mvn] [ERROR] 12:48:01 SchemaExport - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'clob, NAME varchar(255) not null, URL varchar(255), URL_KEY varchar(255), DEFAUL' at line 1
[artifact:mvn] [ERROR] 12:48:01 SchemaExport - Unsuccessful: create table BLC_CONTENT (ID integer not null, ACTIVE_END_DATE timestamp, ACTIVE_START_DA
TE timestamp, APPROVED_BY varchar(255), APPROVED_DATE timestamp, BROWSER_TITLE varchar(255), CONTENT_DATE timestamp, CONTENT_TYPE varchar(255), DEPLOY
ED bit, DESCRIPTION clob, DISPLAY_RULE varchar(255), KEYWORDS varchar(255), LANGUAGE_CODE varchar(255), LAST_MODIFIED_BY varchar(255), LAST_MODIFIED_D
ATE timestamp, META_DESCRIPTION varchar(255), NOTE varchar(255), ONLINE_STATE bit, PARENT_CONTENT_ID integer, PRIORITY integer, REJECTED_BY varchar(25
5), REJECTED_DATE timestamp, RENDER_TEMPLATE varchar(255), SANDBOX varchar(255), SUBMITTED_BY varchar(255), SUBMITTED_DATE timestamp, TITLE varchar(25
5), URL_TITLE varchar(255), primary key (ID))
[artifact:mvn] [ERROR] 12:48:02 SchemaExport - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version fo
r the right syntax to use near 'clob, DISPLAY_RULE varchar(255), KEYWORDS varchar(255), LANGUAGE_CODE varchar(25' at line 1
[artifact:mvn] [ERROR] 12:48:02 SchemaExport - Unsuccessful: create table BLC_CONTENT_DETAILS (CONTENT_HASH varchar(255), XML_CONTENT clob, ID integer
not null, primary key (ID))
[artifact:mvn] [ERROR] 12:48:02 SchemaExport - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version fo
r the right syntax to use near 'clob, ID integer not null, primary key (ID))' at line 1
[artifact:mvn] [ERROR] 12:48:03 SchemaExport - Unsuccessful: create table BLC_FULFILLMENT_OPTION (FULFILLMENT_OPTION_ID bigint not null, FULFILLMENT_T
YPE varchar(255) not null, LONG_DESCRIPTION clob, NAME varchar(255), USE_FLAT_RATES bit, primary key (FULFILLMENT_OPTION_ID))
[artifact:mvn] [ERROR] 12:48:03 SchemaExport - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version fo
r the right syntax to use near 'clob, NAME varchar(255), USE_FLAT_RATES bit, primary key (FULFILLMENT_OPTION_ID)' at line 1
[artifact:mvn] [ERROR] 12:48:04 SchemaExport - Unsuccessful: create table BLC_OFFER_ITEM_CRITERIA (OFFER_ITEM_CRITERIA_ID bigint not null, ORDER_ITEM_
MATCH_RULE clob, QUANTITY integer not null, primary key (OFFER_ITEM_CRITERIA_ID))
[artifact:mvn] [ERROR] 12:48:04 SchemaExport - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version fo
r the right syntax to use near 'clob, QUANTITY integer not null, primary key (OFFER_ITEM_CRITERIA_ID))' at line 1
[artifact:mvn] [ERROR] 12:48:04 SchemaExport - Unsuccessful: create table BLC_OFFER_RULE (OFFER_RULE_ID bigint not null, MATCH_RULE clob, primary key
(OFFER_RULE_ID))
[artifact:mvn] [ERROR] 12:48:04 SchemaExport - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version fo
r the right syntax to use near 'clob, primary key (OFFER_RULE_ID))' at line 1
[artifact:mvn] [ERROR] 12:48:05 SchemaExport - Unsuccessful: create table BLC_PAGE_FLD (PAGE_FLD_ID bigint not null, DATE_CREATED timestamp, DATE_UPDA
TED timestamp, FLD_KEY varchar(255), LOB_VALUE clob, VALUE varchar(255), CREATED_BY bigint, UPDATED_BY bigint, PAGE_ID bigint, primary key (PAGE_FLD_I
D))
[artifact:mvn] [ERROR] 12:48:05 SchemaExport - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version fo
r the right syntax to use near 'clob, VALUE varchar(255), CREATED_BY bigint, UPDATED_BY bigint, PAGE_ID bigint, ' at line 1
[artifact:mvn] [ERROR] 12:48:05 SchemaExport - Unsuccessful: create table BLC_PAGE_ITEM_CRITERIA (PAGE_ITEM_CRITERIA_ID bigint not null, ORDER_ITEM_MA
TCH_RULE clob, QUANTITY integer not null, primary key (PAGE_ITEM_CRITERIA_ID))
[artifact:mvn] [ERROR] 12:48:05 SchemaExport - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version fo
r the right syntax to use near 'clob, QUANTITY integer not null, primary key (PAGE_ITEM_CRITERIA_ID))' at line 1
[artifact:mvn] [ERROR] 12:48:05 SchemaExport - Unsuccessful: create table BLC_PAGE_RULE (PAGE_RULE_ID bigint not null, MATCH_RULE clob, primary key (P
AGE_RULE_ID))
[artifact:mvn] [ERROR] 12:48:05 SchemaExport - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version fo
r the right syntax to use near 'clob, primary key (PAGE_RULE_ID))' at line 1
[artifact:mvn] [ERROR] 12:48:07 SchemaExport - Unsuccessful: create table BLC_SC_FLD (SC_FLD_ID bigint not null, DATE_CREATED timestamp, DATE_UPDATED
timestamp, FLD_KEY varchar(255), LOB_VALUE clob, VALUE varchar(255), CREATED_BY bigint, UPDATED_BY bigint, SC_ID bigint, primary key (SC_FLD_ID))
[artifact:mvn] [ERROR] 12:48:07 SchemaExport - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version fo
r the right syntax to use near 'clob, VALUE varchar(255), CREATED_BY bigint, UPDATED_BY bigint, SC_ID bigint, pr' at line 1
[artifact:mvn] [ERROR] 12:48:08 SchemaExport - Unsuccessful: create table BLC_SC_ITEM_CRITERIA (SC_ITEM_CRITERIA_ID bigint not null, ORDER_ITEM_MATCH_
RULE clob, QUANTITY integer not null, primary key (SC_ITEM_CRITERIA_ID))
[artifact:mvn] [ERROR] 12:48:08 SchemaExport - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version fo
r the right syntax to use near 'clob, QUANTITY integer not null, primary key (SC_ITEM_CRITERIA_ID))' at line 1
[artifact:mvn] [ERROR] 12:48:08 SchemaExport - Unsuccessful: create table BLC_SC_RULE (SC_RULE_ID bigint not null, MATCH_RULE clob, primary key (SC_RU
LE_ID))
[artifact:mvn] [ERROR] 12:48:08 SchemaExport - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version fo
r the right syntax to use near 'clob, primary key (SC_RULE_ID))' at line 1
[artifact:mvn] [ERROR] 12:48:08 SchemaExport - Unsuccessful: create table BLC_SKU (SKU_ID bigint not null, ACTIVE_END_DATE timestamp, ACTIVE_START_DAT
E timestamp, AVAILABLE_FLAG char(255), DESCRIPTION varchar(255), CONTAINER_SHAPE varchar(255), DEPTH numeric(19,2), DIMENSION_UNIT_OF_MEASURE varchar(
255), GIRTH numeric(19,2), HEIGHT numeric(19,2), CONTAINER_SIZE varchar(255), WIDTH numeric(19,2), DISCOUNTABLE_FLAG char(255), IS_MACHINE_SORTABLE bi
t, LONG_DESCRIPTION clob, NAME varchar(255), RETAIL_PRICE numeric(19,5), SALE_PRICE numeric(19,5), TAXABLE_FLAG char(255), WEIGHT numeric(19,2), WEIGH
T_UNIT_OF_MEASURE varchar(255), primary key (SKU_ID))
[artifact:mvn] [ERROR] 12:48:08 SchemaExport - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version fo
r the right syntax to use near 'clob, NAME varchar(255), RETAIL_PRICE numeric(19,5), SALE_PRICE numeric(19,5), T' at line 1
[artifact:mvn] [ERROR] 12:48:09 SchemaExport - Unsuccessful: create table BLC_SKU_FEE (SKU_FEE_ID bigint not null, AMOUNT numeric(19,5) not null, DESC
RIPTION varchar(255), EXPRESSION clob, FEE_TYPE varchar(255), NAME varchar(255), TAXABLE bit, primary key (SKU_FEE_ID))
[artifact:mvn] [ERROR] 12:48:09 SchemaExport - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version fo
r the right syntax to use near 'clob, FEE_TYPE varchar(255), NAME varchar(255), TAXABLE bit, primary key (SKU_FE' at line 1
[artifact:mvn] [ERROR] 12:48:10 SchemaExport - Unsuccessful: alter table BLC_ADDITIONAL_OFFER_INFO add constraint FK3BFDBD63D5F3FAF4 foreign key (OFFE
R_ID) references BLC_OFFER
[artifact:mvn] [ERROR] 12:48:10 SchemaExport - Can't create table 'broadleaf2-demo.#sql-5c8_74' (errno: 150)
[artifact:mvn] [ERROR] 12:48:10 SchemaExport - Unsuccessful: alter table BLC_ADDITIONAL_OFFER_INFO add constraint FK3BFDBD63B5D9C34D foreign key (OFFE
R_INFO_ID) references BLC_OFFER_INFO
[artifact:mvn] [ERROR] 12:48:10 SchemaExport - Can't create table 'broadleaf2-demo.#sql-5c8_74' (errno: 150)
[artifact:mvn] [ERROR] 12:48:10 SchemaExport - Unsuccessful: alter table BLC_ADDITIONAL_OFFER_INFO add constraint FK3BFDBD631891FF79 foreign key (BLC_
ORDER_ORDER_ID) references BLC_ORDER
[artifact:mvn] [ERROR] 12:48:10 SchemaExport - Can't create table 'broadleaf2-demo.#sql-5c8_74' (errno: 150)
[artifact:mvn] [ERROR] 12:48:10 SchemaExport - Unsuccessful: alter table BLC_ADDRESS add constraint FK299F86CE337C4D50 foreign key (STATE_PROV_REGION)
references BLC_STATE
[artifact:mvn] [ERROR] 12:48:10 SchemaExport - Can't create table 'broadleaf2-demo.#sql-5c8_74' (errno: 150)
[artifact:mvn] [ERROR] 12:48:10 SchemaExport - Unsuccessful: alter table BLC_ADDRESS add constraint FK299F86CEA46E16CF foreign key (COUNTRY) reference
s BLC_COUNTRY
[artifact:mvn] [ERROR] 12:48:10 SchemaExport - Can't create table 'broadleaf2-demo.#sql-5c8_74' (errno: 150)
[artifact:mvn] [ERROR] 12:48:11 SchemaExport - Unsuccessful: alter table BLC_ADMIN_PERMISSION_ENTITY add constraint FK23C09E3DE88B7D38 foreign key (AD
MIN_PERMISSION_ID) references BLC_ADMIN_PERMISSION
[artifact:mvn] [ERROR] 12:48:11 SchemaExport - Can't create table 'broadleaf2-demo.#sql-5c8_74' (errno: 150)
[artifact:mvn] [ERROR] 12:48:11 SchemaExport - Unsuccessful: alter table BLC_ADMIN_ROLE_PERMISSION_XREF add constraint FK4A819D985F43AAD8 foreign key
(ADMIN_ROLE_ID) references BLC_ADMIN_ROLE
[artifact:mvn] [ERROR] 12:48:11 SchemaExport - Can't create table 'broadleaf2-demo.#sql-5c8_74' (errno: 150)
[artifact:mvn] [ERROR] 12:48:11 SchemaExport - Unsuccessful: alter table BLC_ADMIN_ROLE_PERMISSION_XREF add constraint FK4A819D98E88B7D38 foreign key
(ADMIN_PERMISSION_ID) references BLC_ADMIN_PERMISSION
[artifact:mvn] [ERROR] 12:48:11 SchemaExport - Can't create table 'broadleaf2-demo.#sql-5c8_74' (errno: 150)
[artifact:mvn] [ERROR] 12:48:12 SchemaExport - Unsuccessful: alter table BLC_ADMIN_USER_PERMISSION_XREF add constraint FKF0B3BEED46EBC38 foreign key (
ADMIN_USER_ID) references BLC_ADMIN_USER
[artifact:mvn] [ERROR] 12:48:12 SchemaExport - Can't create table 'broadleaf2-demo.#sql-5c8_74' (errno: 150)
[artifact:mvn] [ERROR] 12:48:12 SchemaExport - Unsuccessful: alter table BLC_ADMIN_USER_PERMISSION_XREF add constraint FKF0B3BEEDE88B7D38 foreign key
(ADMIN_PERMISSION_ID) references BLC_ADMIN_PERMISSION
[artifact:mvn] [ERROR] 12:48:12 SchemaExport - Can't create table 'broadleaf2-demo.#sql-5c8_74' (errno: 150)
[artifact:mvn] [ERROR] 12:48:12 SchemaExport - Unsuccessful: alter table BLC_ADMIN_USER_ROLE_XREF add constraint FKFFD33A265F43AAD8 foreign key (ADMIN
_ROLE_ID) references BLC_ADMIN_ROLE
[artifact:mvn] [ERROR] 12:48:12 SchemaExport - Can't create table 'broadleaf2-demo.#sql-5c8_74' (errno: 150)
[artifact:mvn] [ERROR] 12:48:12 SchemaExport - Unsuccessful: alter table BLC_ADMIN_USER_ROLE_XREF add constraint FKFFD33A2646EBC38 foreign key (ADMIN_
USER_ID) references BLC_ADMIN_USER
[artifact:mvn] [ERROR] 12:48:12 SchemaExport - Can't create table 'broadleaf2-demo.#sql-5c8_74' (errno: 150)
[artifact:mvn] [ERROR] 12:48:12 SchemaExport - Unsuccessful: alter table BLC_ADMIN_USER_SANDBOX add constraint FKD0A97E0946EBC38 foreign key (ADMIN_US
ER_ID) references BLC_ADMIN_USER
[artifact:mvn] [ERROR] 12:48:12 SchemaExport - Can't create table 'broadleaf2-demo.#sql-5c8_74' (errno: 150)
[artifact:mvn] [ERROR] 12:48:12 SchemaExport - Unsuccessful: alter table BLC_ADMIN_USER_SANDBOX add constraint FKD0A97E09579FE59D foreign key (SANDBOX
_ID) references BLC_SANDBOX
[artifact:mvn] [ERROR] 12:48:12 SchemaExport - Can't create table 'broadleaf2-demo.#sql-5c8_74' (errno: 150)
[artifact:mvn] [ERROR] 12:48:13 SchemaExport - Unsuccessful: alter table BLC_AMOUNT_ITEM add constraint FKB98530944BC71D98 foreign key (PAYMENT_ID) re
ferences BLC_ORDER_PAYMENT
[artifact:mvn] [ERROR] 12:48:13 SchemaExport - Can't create table 'broadleaf2-demo.#sql-5c8_74' (errno: 150)
[artifact:mvn] [ERROR] 12:48:13 SchemaExport - Unsuccessful: alter table BLC_ASSET_DESC_MAP add constraint FKE886BAE367F70B63 foreign key (STATIC_ASSE
T_ID) references BLC_STATIC_ASSET
[artifact:mvn] [ERROR] 12:48:13 SchemaExport - Can't create table 'broadleaf2-demo.#sql-5c8_74' (errno: 150)
[artifact:mvn] [ERROR] 12:48:13 SchemaExport - Unsuccessful: alter table BLC_ASSET_DESC_MAP add constraint FKE886BAE3E2BA0C9D foreign key (STATIC_ASSE
T_DESC_ID) references BLC_STATIC_ASSET_DESC
[artifact:mvn] [ERROR] 12:48:13 SchemaExport - Can't create table 'broadleaf2-demo.#sql-5c8_74' (errno: 150)
[artifact:mvn] [ERROR] 12:48:13 SchemaExport - Unsuccessful: alter table BLC_BUNDLE_ORDER_ITEM add constraint FK489703DB9AF166DF foreign key (ORDER_IT
EM_ID) references BLC_ORDER_ITEM
[artifact:mvn] [ERROR] 12:48:13 SchemaExport - Can't create table 'broadleaf2-demo.#sql-5c8_74' (errno: 150)
[artifact:mvn] [ERROR] 12:48:13 SchemaExport - Unsuccessful: alter table BLC_BUNDLE_ORDER_ITEM add constraint FK489703DBB78C9977 foreign key (SKU_ID)
references BLC_SKU
[artifact:mvn] [ERROR] 12:48:13 SchemaExport - Can't create table 'broadleaf2-demo.#sql-5c8_74' (errno: 150)
[artifact:mvn] [ERROR] 12:48:13 SchemaExport - Unsuccessful: alter table BLC_BUNDLE_ORDER_ITEM add constraint FK489703DBCCF29B96 foreign key (PRODUCT_
BUNDLE_ID) references BLC_PRODUCT_BUNDLE
[artifact:mvn] [ERROR] 12:48:13 SchemaExport - Can't create table 'broadleaf2-demo.#sql-5c8_74' (errno: 150)
[artifact:mvn] [ERROR] 12:48:13 SchemaExport - Unsuccessful: alter table BLC_BUND_ITEM_FEE_PRICE add constraint FK14267A943FC68307 foreign key (BUND_O
RDER_ITEM_ID) references BLC_BUNDLE_ORDER_ITEM
[artifact:mvn] [ERROR] 12:48:13 SchemaExport - Can't create table 'broadleaf2-demo.#sql-5c8_74' (errno: 150)
[artifact:mvn] [ERROR] 12:48:13 SchemaExport - Unsuccessful: alter table BLC_CANDIDATE_FG_OFFER add constraint FKCE78560D5F3FAF4 foreign key (OFFER_ID
) references BLC_OFFER
[artifact:mvn] [ERROR] 12:48:13 SchemaExport - Can't create table 'broadleaf2-demo.#sql-5c8_74' (errno: 150)
[artifact:mvn] [ERROR] 12:48:13 SchemaExport - Unsuccessful: alter table BLC_CANDIDATE_FG_OFFER add constraint FKCE785605028DC55 foreign key (FULFILLM
ENT_GROUP_ID) references BLC_FULFILLMENT_GROUP
.
.
.
.
.
.
I suspect that "your MySQL server version for the right syntax to use near 'clob, NAME varchar(255) not null, URL varchar(255), URL_KEY varchar(255), DEFAUL' at line 1" line (bold above) cause the issue.

Have anyone encountered and fixed this..??

Thanks,
Saman

Re: Migrating from in memory database to MySQL Broadleaf 2.0

Posted: Tue Jul 31, 2012 8:47 am
by saman
I found bug on demo site.

Table name defined in org.broadleafcommerce.core.search.domain.CategorySearchFacetImpl domain class is BLC_CAT_SEARCH_FACET_XREF. But insert statement appeared in the load_catalog_data.sql (site\src\main\resources\sql\load_catalog_data.sql) file contains BLC_CATEGORY_SEARCH_FACET_XREF

Re: Migrating from in memory database to MySQL Broadleaf 2.0

Posted: Tue Jul 31, 2012 9:13 am
by dilupa.m
Hi Saman,
I also ran into some issues while doing the migration. May be the dev team can shed some light on this. Here are the steps i took. Please note that im using MySQL Ver 14.14 Distrib 5.1.40, for Win64

Parent Pom.xml
1. Add MySql Dependency

Code: Select all

<dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.6</version>
        <type>jar</type>
        <scope>compile</scope>
</dependency


Site pom.xml
1.Add mysql Dependancy

Code: Select all

<dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <scope>runtime</scope>
</dependency>


core\src\main\resources\runtime-properties\common-shared.properties

1.Change hibernate dialects to MySQL
blPU.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
blCMSStorage.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
blSecurePU.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect


site\src\main\webapp\WEB-INF\jetty-env.xml
1.Change WebDS datasource

Code: Select all

<New id="webDS" class="org.eclipse.jetty.plus.jndi.Resource">
      <Arg>jdbc/web</Arg>
      <Arg>
         <New class="org.apache.commons.dbcp.BasicDataSource">
            <Set name="driverClassName">com.mysql.jdbc.Driver</Set>
            <Set name="url">jdbc:mysql://localhost:3306/broadleaf2</Set>
            <Set name="username">root</Set>
            <Set name="password">root</Set>
         </New>
      </Arg>
</New>


2.Change webSecureDS data source

Code: Select all

<New id="webSecureDS" class="org.eclipse.jetty.plus.jndi.Resource">
      <Arg>jdbc/webSecure</Arg>
      <Arg>
         <New class="org.apache.commons.dbcp.BasicDataSource">
            <Set name="driverClassName">com.mysql.jdbc.Driver</Set>
            <Set name="url">jdbc:mysql://localhost:3306/broadleaf2</Set>
            <Set name="username">root</Set>
            <Set name="password">root</Set>
         </New>
      </Arg>
</New>


Run ant jetty-demo

Creation of the following tables fail
BLC_SKU_FULFILLMENT_FLAT_RATES and BLC_STATIC_ASSET_STRG

Code: Select all

[artifact:mvn] [ERROR] 18:44:34 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)) ENGINE=InnoDB
[artifact:mvn] [ERROR] 18:44:34 SchemaExport - BLOB/TEXT column 'FULFILLMENT_OPTION_ID' used in key specification without a key length
[artifact:mvn] [ERROR] 18:45:23 SchemaExport - Unsuccessful: alter table BLC_SKU_FULFILLMENT_FLAT_RATES add index FKC1988C96B78C9977 (SKU_ID), add constraint FKC1988C96B78C9977 foreign key (SKU_ID) references BLC_SKU (SKU_ID)
[artifact:mvn] [ERROR] 18:45:23 SchemaExport - Table 'broadleaf2.blc_sku_fulfillment_flat_rates' doesn't exist


Code: Select all

[artifact:mvn] [ERROR] 18:45:36 SchemaExport - Unsuccessful: create table BLC_STATIC_ASSET_STRG (STATIC_ASSET_STRG_ID bigint not null, FILE_DATA longblob, STATIC_ASSET_ID bigint not null, primary key (STATIC_ASSET_STRG_ID)) ENGINE=InnoDB
[artifact:mvn] [ERROR] 18:45:36 SchemaExport - type not found or user lacks privilege: LONGBLOB
[artifact:mvn] [ERROR] 18:45:36 SchemaExport - Unsuccessful: create index STATIC_ASSET_ID_INDEX on BLC_STATIC_ASSET_STRG (STATIC_ASSET_ID)
[artifact:mvn] [ERROR] 18:45:36 SchemaExport - user lacks privilege or object not found: BLC_STATIC_ASSET_STRG


I commented out importing the sql scripts to get a clean log. The log file can be viewed here.
http://pastebin.com/YzgU4Kwg

Should i try this for MySQL 5.5?

Edit:
I did some digging on the first error for the BLC_SKU_FULFILLMENT_FLAT_RATES table. the sql statement is trying to make the FULFILLMENT_OPTION_ID field which is a tinyblob as the primary key. Mysql advices that these types (text, blob, tinyblob) should contain a key length. eg: FULFILLMENT_OPTION_ID tinyblob(1024) for it to classify the field as primary key. reading on this issue, i found that key lengths arent supported these types. Please refer to the following articles for more information. May be this would be useful
http://stackoverflow.com/questions/1827 ... key-length
http://bugs.mysql.com/bug.php?id=47785


Thanks

Re: Migrating from in memory database to MySQL Broadleaf 2.0

Posted: Tue Jul 31, 2012 3:17 pm
by phillipuniverse
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: Migrating from in memory database to MySQL Broadleaf 2.0

Posted: Tue Jul 31, 2012 10:03 pm
by saman
Thanks dilupa.m, pverheyden for the quick and detailed response. it is simply a table name change in insert statement and data type change in entity class (if possible). In addition to the fixing reported bug, it is better if someone can document the database migration steps reported by dilupa.m. It is fairly straightforward and easy steps for documentation.

Re: Migrating from in memory database to MySQL Broadleaf 2.0

Posted: Wed Aug 01, 2012 7:47 am
by dilupa.m
Thanks for the quick response. What do we need to do once a fix has been issued? Is it a matter of just updating our pom.xml?
We would be very thankful if you could let us know once the bug has been fixed.
Thanks

Re: Migrating from in memory database to MySQL Broadleaf 2.0

Posted: Wed Aug 01, 2012 10:36 am
by phillipuniverse
For BLC_SKU_FULFILLMENT_FLAT_RATES, the fix ended up being a need to add @MapKeyClass(FulfillmentOptionImpl.class). Normally Map structures don't need this annotation if they are properly parameterized (like this one is) but this map is parameterzed with FulfillmentOption as the key. FulfillmentOption is just an interface and isn't an actual entity, so Hibernate maps that column like it doesn't know anything about it (because it doesn't). Changing the field to include this annotation fixed the issue, and now that column is being mapped as a bigint.

I'm pushing up this change now and it will be available as part of the daily 2.0.0-SNAPSHOT build later today. If you are already targeting this snapshot you won't have to make a pom change. This will also be picked up in a milestone release sometime later this week (I believe as M1-3) which you will have to modify your pom for.

We're currently looking into the other issue involving BLC_STATIC_ASSET_STRG; will report back shortly.

Re: Migrating from in memory database to MySQL Broadleaf 2.0

Posted: Wed Aug 01, 2012 12:34 pm
by phillipuniverse
Dilupa,

I would definitely update MySQL to 5.5 if at all possible. I can create the BLC_STATIC_ASSET_STRG table on 5.5 with no issues. I'm currently investigating with your version (5.1.40) but it seems a little odd that the LONGBLOB field type would not be available; according to http://dev.mysql.com/doc/refman/5.1/en/ ... ments.html it says that the LONGBLOB field type is an actual type.

Re: Migrating from in memory database to MySQL Broadleaf 2.0

Posted: Wed Aug 01, 2012 2:28 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: Migrating from in memory database to MySQL Broadleaf 2.0

Posted: Thu Aug 02, 2012 9:21 am
by dilupa.m
Hi Guys,
I can confirm that V2.0 M1-4 build is generating the mysql schema without any issues. Thanks for your efforts. :)
However i think there's something wrong with the load_catalog_data.sql file cuz when i try to access the demo site through localhost:8080 i get the following exception.

Code: Select all

Caused by: org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x8) was found in the element content of the document.
See pasty for full stacktrace. http://pastebin.com/nRJfjPQq


So ended up searching for this character in all the SQLs. and i found 61327 instances of the 0x8 character (backspace control character) in the load_catalog_data.sql file. Other sql files didnt have this character. We tested this in 2 dev environments which gave the same result.

Following is my dev environment
Java: 1.6.0_18-b07 64Bit
MySQL: 5.5.11
Maven: 3.0.4
Ant: 1.8.4

Following are the steps to reproduce

Code: Select all

1. Downloaded Broadleaf Eclipse Workspace (https://github.com/downloads/BroadleafCommerce/DemoSite/DemoSite-2.0.0-M1-4-eclipse-workspace.zip)
2. Imported to existing worksapce as a new project
3. Parent build successful
4. HSQLDB start up succesful
6. Moving database to MySQL
   i. Created new database "clne"
   ii. Added MySQL dependency to parent pom
      <dependency>
         <groupId>mysql</groupId>
         <artifactId>mysql-connector-java</artifactId>
         <version>5.1.6</version>
         <type>jar</type>
         <scope>compile</scope>
      </dependency
   iii. Commented HSQL dependecy from site pom
   iv. Added MySQL dependecy to site pom
      <dependency>
         <groupId>mysql</groupId>
         <artifactId>mysql-connector-java</artifactId>
         <scope>runtime</scope>
      </dependency>
   v. Changed dialects to MySQL in common-shared.properties
      blPU.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
      blCMSStorage.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
      blSecurePU.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
   vi. Changed Datasources in jetty-env.xml
      <New id="webDS" class="org.eclipse.jetty.plus.jndi.Resource">
         <Arg>jdbc/web</Arg>
         <Arg>
            <New class="org.apache.commons.dbcp.BasicDataSource">
               <Set name="driverClassName">com.mysql.jdbc.Driver</Set>
               <Set name="url">jdbc:mysql://localhost:3306/clne</Set>
               <Set name="username">root</Set>
               <Set name="password">root</Set>
            </New>
         </Arg>
      </New>
      
      <New id="webSecureDS" class="org.eclipse.jetty.plus.jndi.Resource">
         <Arg>jdbc/webSecure</Arg>
         <Arg>
            <New class="org.apache.commons.dbcp.BasicDataSource">
               <Set name="driverClassName">com.mysql.jdbc.Driver</Set>
               <Set name="url">jdbc:mysql://localhost:3306/clne</Set>
               <Set name="username">root</Set>
               <Set name="password">root</Set>
            </New>
         </Arg>
      </New>
      
      <New id="cmsStorageDS" class="org.eclipse.jetty.plus.jndi.Resource">
         <Arg>jdbc/cmsStorage</Arg>
         <Arg>
            <New class="org.apache.commons.dbcp.BasicDataSource">
               <Set name="driverClassName">com.mysql.jdbc.Driver</Set>
               <Set name="url">jdbc:mysql://localhost:3306/clne</Set>
               <Set name="username">root</Set>
               <Set name="password">root</Set>
            </New>
         </Arg>
      </New>
   vii. Building parent pom succesful
   vii. ant jetty-demo for site folder started without any errors
   viii. Running the site. Received unicode error from java for '0x8' see error log


What im not certain is why i dont get this error for HSQL db. May be its stripping out all non-ascii characters. Can anyone confirm this?
Thanks