Page 1 of 1

Error Creating Static Asset in Admin 1.5.4

Posted: Thu Apr 19, 2012 2:15 pm
by jdsilva
Hi all:

I'm trying to create a static asset in broadleaf admin; no code modifications have been made by myself to this section of the admin. When I click the add button in the Assets section of the Content Management module, I select my file and fill out the name and full URL fields, and then click upload. The following error message appears in the browser:

Could not execute JDBC batch update; SQL [insert into BLC_SANDBOX_ITEM (ARCHIVED_FLAG, CREATED_BY, DATE_CREATED, DATE_UPDATED, UPDATED_BY, DESCRIPTION, ORIGINAL_ITEM_ID, ORIG_SANDBOX_ID, SANDBOX_ID, SANDBOX_ITEM_TYPE, SANDBOX_OPERATION_TYPE, TEMPORARY_ITEM_ID, SANDBOX_ITEM_ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; nested exception is org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update

From my server log, the following appears stack trace appears. Is there some configuration I need to do before I can create this object in the admin? I am logged into the admin tool with the admin account.

Caused by: org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:114)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:109)
at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:244)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2411)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2874)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:79)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:265)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:184)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:383)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:133)
at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:76)
at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:467)
... 86 more
Caused by: java.sql.BatchUpdateException: Batch entry 0 insert into BLC_SANDBOX_ITEM (ARCHIVED_FLAG, CREATED_BY, DATE_CREATED, DATE_UPDATED, UPDATED_BY, DESCRIPTION, ORIGINAL_ITEM_ID, ORIG_SANDBOX_ID, SANDBOX_ID, SANDBOX_ITEM_TYPE, SANDBOX_OPERATION_TYPE, TEMPORARY_ITEM_ID, SANDBOX_ITEM_ID) values ('N', '1', '2012-04-19 14:45:45.040000 -04:00:00', NULL, NULL, '/img_storefront.jpg', NULL, NULL, '5000', 'STATIC_ASSET', 'ADD', '20', '200') was aborted. Call getNextException to see the cause.
at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2598)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:407)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2737)
at com.sun.gjc.spi.base.StatementWrapper.executeBatch(StatementWrapper.java:585)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
... 102 more



Thanks for any help you can provide.

Re: Error Creating Static Asset in Admin 1.5.4

Posted: Thu Apr 19, 2012 5:08 pm
by jdsilva
The server log also shows:

JDBCExceptionReporter - ERROR: column "archived_flag" is of type boolean but expression is of type character varying


Has anyone experienced this before? Does it have to do with the DBMS I am using (postgres)?

Re: Error Creating Static Asset in Admin 1.5.4

Posted: Fri Apr 20, 2012 4:17 pm
by jdsilva
I was able to overcome this issue by correcting the table defnitions for blc_sandbox_item (changed archived_flag to character varying (1)) and blc_sandbox_action (changed comment field to action_comment). I also had to correct a wrong column name in blc_asset_desc_map table for static_asset_id.

My question now is how can I reference the full path of the filename where the DB will write the file on the filesystem? To make things more clear, I wish to store velocity e-mail templates as static assets, not images in this case. I want to get the full path to the file that is created by whichever broadleaf service is called to retrieve the asset. Which broadleaf service should be called to retrieve the asset, anyway?

Thanks.