Page 2 of 2

Re: MySQL Tables Only Partially Created

Posted: Sat Feb 15, 2014 12:45 pm
by rcampion
This is a Hibernate bug IMHO.

Also, I see that the @Lob problem is nothing new to Broadleaf Commerce.

https://github.com/BroadleafCommerce/Br ... 0595eacc0f

MySQL server support for CLOB with 4 data types:

TINYTEXT - A CLOB column with a maximum length of 255 (2**8 - 1) characters.
TEXT - A CLOB column with a maximum length of 65,535 (2**16 - 1) characters.
MEDIUMTEXT - A CLOB column with a maximum length of 16,777,215 (2**24 - 1) characters.
LONGTEXT - A CLOB column with a maximum length of 4,294,967,295 or 4GB (2**32 - 1) characters.

Tables / Entities in question.

BLC_SC_FLD => StructuredContentFieldImpl
BLC_SKU => SkuImpl
BLC_SKU_FEE => SkuFeeImpl
BLC_PAGE_FLD => PageFieldImpl
BLC_TRANSLATION => TranslationImpl
BLC_SC_ITEM_CRITERIA => StructuredContentItemCriteriaImpl
BLC_CATEGORY => CategoryImpl
BLC_PAGE_ITEM_CRITERIA => PageItemCriteriaImpl
BLC_FULFILLMENT_OPTION => FulfillmentOptionImpl
BLC_OFFER => OfferImpl
BLC_OFFER_ITEM_CRITERIA => OfferItemCriteriaImpl
BLC_PAGE_RULE => PageRuleImpl
BLC_SC_RULE => StructuredContentRuleImpl
BLC_FULFILLMENT_OPTION => FulfillmentOptionImp
BLC_SC_FLD => StructuredContentFieldImpl

/*
* Hibernate bug ... MySQL dialect should create a TEXT datatype for @Lob String(s)
* MySQL Notes:
* StringClobType produces invalid SQL
* MaterializedClobType produces invalid SQL
* TextType produces VARCHAR with invalid length in SQL
* length property in @Column is ignored, total row max = 65535
*/

//@Column(name = "LOB_VALUE")
//@Column(name = "LOB_VALUE", length = Integer.MAX_VALUE-1)
@Column(name = "LOB_VALUE", length = 65535)
//@Column(name = "LOB_VALUE", columnDefinition = "TEXT")
@Lob
//@Type(type = "org.hibernate.type.StringClobType")
//@Type(type = "org.hibernate.type.MaterializedClobType")
@Type(type = "org.hibernate.type.TextType")
protected String lobValue;

CREATE TABLE BLC_SC_FLD (
SC_FLD_ID BIGINT NOT NULL,
CREATED_BY BIGINT,
DATE_CREATED TIMESTAMP,
DATE_UPDATED TIMESTAMP,
UPDATED_BY BIGINT,
FLD_KEY VARCHAR(255),
LOB_VALUE VARCHAR(16777216),
VALUE VARCHAR(255),
SC_ID BIGINT
);

The LOB_VALUE now has a datatype but the row size exceeds the maximum size of 65535.

So let's replace all VARCHAR(16777216) with TEXT and see if all tables get created. ....

Yes, all tables get created.

Will this work if we then populate the data and set "create-drop" to none?

Let's see.

data population ...

config/bc/sql/load_admin_permissions.sql ....... success.
config/bc/sql/load_admin_roles.sql .................. success.
config/bc/sql/load_admin_menu.sql.................. success.
sql/load_admin_users.sql................................ success.
sql/load_code_tables.sql................................. success.
sql/load_table_sequences.sql.......................... success.
sql/load_content_structure.sql......................... success.
sql/load_catalog_data.sql................................ failure. Syntax errors.
sql/load_catalog_pricesplit_data.sql
sql/load_content_data.sql
sql/load_content_structure_i18n.sql
sql/load_content_data_i18n.sql
sql/load_catalog_i18n_data_FR.sql
sql/load_catalog_i18n_data_ES.sql

There are syntactical errors in the load_catalog_data.sql file like missing semi-colon(s), embedded apostrophe(s) in text fields.

And the load_catalog_pricesplit_data.sql does not exist as previosly mentioned in a prior post.

-Richard

Re: MySQL Tables Only Partially Created

Posted: Sat Feb 15, 2014 8:01 pm
by rcampion
Even with the erroneous data, the admin site will run and I was able to create a new product via the admin UI.

I verified that the newly created product was persisted in the MySQL database.

However, the demo site itself would not render most pages except for the http://localhost:8080/cart page.

Perhaps if the load_catalog_data.sql file was valid and a load_catalog_pricesplit_data.sql was provided then who knows, the demo sight might render all pages.

-Richard

Re: MySQL Tables Only Partially Created

Posted: Sun Feb 16, 2014 1:03 am
by rcampion
Downloaded 3.1.0 ... DemoSite-3.1.0-GA-eclipse-workspace.zip

1.) Followed the Getting Started Guide and tested HSQLDB ... Good.

2.) Followed the Using MySQL tutorial .... Good.

No Problems!

Same number of tables in both databases.

@Lob string data is being stored as LONGTEXT in MySQL.

Congratulations on your new release!

Thank you.