1

我成功地编写了部署程序扩展和存储扩展。

以下是我从核心日志中获取的日志,显示所有内容都已完美加载!!

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:无法持久化数据实体,提交事务时出错,提交事务时出错”

这是我的实体类的任何问题还是我缺少的东西。

编辑:在 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.

谢谢

4

3 回答 3

1

The error you're getting is suggesting that your ID column is not defined correctly as an identity or that you're trying to manually set a value to the autogenerated value in this column. Hope this helps.

Regards, Daniel.

于 2013-01-08T13:52:55.187 回答
0

The ID column should be set to auto increment at db level. Have a look at my original article on sdltridionworld for an example http://www.sdltridionworld.com/articles/sdltridion2011/tutorials/extending-content-delivery-storage-sdltridion-2011-1.aspx

"For SQL Server, column ID is defined as IDENTITY(1,1), so it increments automatically by one, without us having to specify value.

对于 Oracle,需要使用序列(生成值)定义列 ID,如下所示: CREATE SEQUENCE SEQ_PUBLISH_ACTIONS MAXVALUE 999999999999999 CYCLE START WITH 1 / CREATE OR REPLACE TRIGGER PUBLISH_ACTIONS_KEY BEFORE INSERT ON PUBLISH_ACTIONS FOR EACH BEGIN IF :new.ID IS NULL THEN SELECT SEQ_PUBLISH_ACTIONS.NEXTVAL INTO :new.ID FROM DUAL; 万一; 结尾; / "

于 2013-01-08T21:25:24.010 回答
0

以上问题在我的实体类中,我需要为我的身份列添加以下注释。

@Id
@Column(name = "ID", unique=true,updatable=false,insertable=false)
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;

如果需要任何更改,请提出建议。

谢谢

于 2013-01-09T08:23:08.050 回答