我成功地设法编写了部署者扩展以及存储扩展。
以下是我从核心日志中获取的日志,它显示所有内容都已完美加载!!
2013-01-08 11:30:19,759 INFO BundleConfigurationLoader - Added 'PublishAction' for storage 'persistence' with 'com.tridion.storage.dao.JPAPublishActionDAO'.
2013-01-08 11:30:38,259 DEBUG JPAPublishActionDAO - Constructor of JPAPublishActionDAO- storageId:searchdb
2013-01-08 11:30:38,259 DEBUG JPAPublishActionDAO - Constructor of JPAPublishActionDAO- entityManagerFactory:true
2013-01-08 11:30:38,259 DEBUG JPAPublishActionDAO - Constructor of JPAPublishActionDAO- storageName:PublishAction
2013-01-08 11:19:38,400 INFO Module - No TransformProcessor configured, will not transform files before deployment for module com.tridion.custom.extensions.SearchPageDeployer
2013-01-08 11:30:38,400 DEBUG SearchPageDeployer - Constructor of SearchPageDeployer //This is my PageDeployer Constructor
2013-01-08 11:30:38,744 DEBUG SearchPageDeployer - Called processPage from SearchPageDeployer //This is my process Page of pagedeployer class
2013-01-08 11:30:38,572 DEBUG SearchPageDeployer - SearchPageDeployer Called processItem
2013-01-08 11:30:38,572 DEBUG StorageManagerFactory - Default storage provider has caching set to: false
2013-01-08 11:30:38,572 DEBUG StorageManagerFactory - Loaded following dao Properties[publication=0, typeMapping=PublishAction, storageId=searchdb, cached=false] for publication/typeMapping/itemExtension: 0 / PublishAction / null
2013-01-08 11:30:38,572 DEBUG StorageManagerFactory - Loading a non cached DAO for publicationId/typeMapping/itemExtension: 0 / PublishAction / null
2013-01-08 11:30:38,572 DEBUG StorageManagerFactory - Wrapping DAO's, currently 0 wrappers installed
2013-01-08 11:30:38,572 INFO JPAPublishActionDAO - Entering Method: JPAPublishActionDAO.PublishAction.store
2013-01-08 11:40:33,228 ERROR SearchPageDeployer - SearchPageDeployer - Exception occurred com.tridion.broker.StorageException: Unable to persist data entity, Error while commiting the transaction, Error while commiting the transaction
现在当我尝试将数据存储在我的表中时,我得到“异常发生com.tridion.broker.StorageException:无法持久保存数据实体,提交事务时出错,提交事务时出错”
这是我的Entity类或我遗漏的任何问题。
编辑:在logback xml中启用记录器级别“ON”后。
我在核心文件中遇到以下异常:
2013-01-08 14:42:10,713 DEBUG SQL - insert into AUTN_ITEMS (ACTION, FLAG, ITEM_TYPE, LAST_PUBLISHED_DATE, PUBLICATION_ID, SCHEMA_ID, TCMURI, URL, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?)
2013-01-08 14:42:10,728 DEBUG AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2013-01-08 14:42:10,744 DEBUG JDBCExceptionReporter - could not insert: [com.tridion.storage.dao.PublishAction] [insert into AUTN_ITEMS (ACTION, FLAG, ITEM_TYPE, LAST_PUBLISHED_DATE, PUBLICATION_ID, SCHEMA_ID, TCMURI, URL, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?)]
com.microsoft.sqlserver.jdbc.SQLServerException: Cannot insert explicit value for identity column in table 'AUTN_ITEMS' when IDENTITY_INSERT is set to OFF.
由于
答案 0 :(得分:1)
您收到的错误表明您的ID列未正确定义为标识,或者您尝试在此列中手动将值设置为自动生成的值。 希望这会有所帮助。
此致 丹尼尔。
答案 1 :(得分:0)
ID列应设置为db级别的自动增量。请查看我在sdltridionworld上的原始文章,获取示例http://www.sdltridionworld.com/articles/sdltridion2011/tutorials/extending-content-delivery-storage-sdltridion-2011-1.aspx
“对于SQL Server,列ID定义为IDENTITY(1,1),因此它会自动递增1,而不必指定值。
对于Oracle,需要使用Sequence(生成值)定义列ID,如下所示: 创建序列SEQ_PUBLISH_ACTIONS MAXVALUE 999999999999999 CYCLE START WITH 1 / 创建或替换TRIGGER PUBLISH_ACTIONS_KEY 在插入PUBLISH_ACTIONS之前 对于每一行 开始 IF:new.ID IS NULL那么 SELECT SEQ_PUBLISH_ACTIONS.NEXTVAL INTO:new.ID FROM DUAL; 万一; 结束; / “
答案 2 :(得分:0)
上面的问题出现在我的实体类中,我需要为我的标识列添加以下注释。
@Id
@Column(name = "ID", unique=true,updatable=false,insertable=false)
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
如果需要进行任何更改,请建议。
由于