留言板

Exception sql produite par classe générée par service builder

thumbnail
Michel Wicky,修改在12 年前。

Exception sql produite par classe générée par service builder

Regular Member 帖子: 130 加入日期: 10-7-3 最近的帖子
Nous rencontrons un problème lors de l'exécution d'une portlet dont les services de données ont été générés avec service builder.

Une erreur est produite: 14:27:40,342 ERROR [JDBCExceptionReporter:101] ORA-00904: "SLRDOCUMEN0_"."SLR_DOC_TYP_SUB_TITLE" : identificateur non valide

Le nom de la table est mystérieux .. il ne correspond à rien et à aucune des définitions de service.xml !

at slr.comment.service.persistence.SlrDocumentTypPersistenceImpl.findAll(SlrDocumentTypPersistenceImpl.java:455)
at slr.comment.service.persistence.SlrDocumentTypPersistenceImpl.findAll(SlrDocumentTypPersistenceImpl.java:391)

Le code généré dans ces classes par service builder, notamment les chaînes de caractères avec les instructions SQL ne semblent pas être bizarres a priori.

Est-ce un problème connu ?
Comment est-il possible de déterminer la cause du problème et corriger ?

Merci pour votre aide !
thumbnail
David H Nebinger,修改在12 年前。

RE: Exception sql produite par classe générée par service builder

Liferay Legend 帖子: 14915 加入日期: 06-9-2 最近的帖子
I think that SB truncated your original table from SlrDocumentTyp and did a little bit of renaming to come up with the unique SLRDOCUMEN0_

In my own SB code, sometimes I have had to go back and edit the SQL generated in docroot/WEB-INF/sql/tables.sql to adjust types and sizes. And other times I've had to adjust the hibernate mapping files generated in docroot/WEB-INF/src/META-INF/portlet-hbm.xml in order to resolve some java type issues, but I don't remember getting an exception about an invalid identifier...

If you wouldn't mind posting the relevant snippets from your service.xml and portlet-hbm.xml files, I might be able to help you with this...

Sorry my response is in english, but I used babelfish to translate your question so I could help and my French is very rusty emoticon
thumbnail
Michel Wicky,修改在12 年前。

RE: Exception sql produite par classe générée par service builder

Regular Member 帖子: 130 加入日期: 10-7-3 最近的帖子
Thank you David for you response.

I also created a thread in the english forum : http://www.liferay.com/community/forums/-/message_boards/message/8808546 and opened an issue LPS-17219.
All project code and scripts to create the database are available attached to the issue LPS-17219.

Note that i disabled table autogeneration in service-ext.properties (build.auto.upgrade=false). The schema is already created with our own scripts. We are using a customized datasource (i mean we are not using lportal).
thumbnail
Michel Wicky,修改在12 年前。

RE: Exception sql produite par classe générée par service builder

Regular Member 帖子: 130 加入日期: 10-7-3 最近的帖子
indexes.sql, sequences.sql and tables.sql are empty in WEB-INF/sql and I think it is normal (I like that).

Hibernate definitions seem ok to me also:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping default-lazy="false" auto-import="false">
<import class="slr.comment.model.SlrDocumentTyp" />
<import class="slr.comment.model.SlrDocument" />
<import class="slr.comment.model.SlrAnchor" />
<import class="slr.comment.model.SlrDocumentStructure" />
<import class="slr.comment.model.SlrComment" />
<import class="slr.comment.model.SlrGraph" />
<class name="slr.comment.model.impl.SlrDocumentTypImpl" table="SLR_DOCUMENT_TYP">
<cache usage="read-write" />
<id name="SlrDocumentTypId" column="SLR_DOCUMENT_TYP_ID" type="long">
<generator class="sequence">
<param name="sequence">SLR_DOCUMENT_TYP_SEQ</param>
</generator>
</id>
<property name="SlrDocTypLabel" column="SLR_DOC_TYP_LABEL" type="com.liferay.portal.dao.orm.hibernate.StringType" />
<property name="SlrDocTypMainTitle" column="SLR_DOC_TYP_MAIN_TITLE" type="com.liferay.portal.dao.orm.hibernate.StringType" />
<property name="SlrDocTypSubTitle" column="SLR_DOC_TYP_SUB_TITLE" type="com.liferay.portal.dao.orm.hibernate.StringType" />
<property name="SlrDocTypDesc" column="SLR_DOC_TYP_DESC" type="com.liferay.portal.dao.orm.hibernate.StringType" />
</class>
<class name="slr.comment.model.impl.SlrDocumentImpl" table="SLR_DOCUMENT">
<cache usage="read-write" />
<id name="SlrDocumentId" column="SLR_DOCUMENT_ID" type="long">
<generator class="sequence">
<param name="sequence">SLR_DOCUMENT_SEQ</param>
</generator>
</id>
<property name="SlrDocumentTypId" column="SLR_DOCUMENT_TYP_ID" type="com.liferay.portal.dao.orm.hibernate.LongType" />
<property name="SlrDocumentDateFrom" column="SLR_DOCUMENT_DATE_FROM" type="org.hibernate.type.TimestampType" />
<property name="SlrDocumentDateTo" column="SLR_DOCUMENT_DATE_TO" type="org.hibernate.type.TimestampType" />
<property name="SlrDocumentPeriodLabel" column="SLR_DOCUMENT_PERIOD_LABEL" type="com.liferay.portal.dao.orm.hibernate.StringType" />
</class>
<class name="slr.comment.model.impl.SlrAnchorImpl" table="SLR_ANCHOR">
<cache usage="read-write" />
<id name="SlrAnchorId" column="SLR_ANCHOR_ID" type="long">
<generator class="sequence">
<param name="sequence">SLR_ANCHOR_SEQ</param>
</generator>
</id>
<property name="SlrAnchorLabel" column="SLR_ANCHOR_LABEL" type="com.liferay.portal.dao.orm.hibernate.StringType" />
<property name="SlrAnchorHeader1" column="SLR_ANCHOR_HEADER1" type="com.liferay.portal.dao.orm.hibernate.StringType" />
<property name="SlrAnchorHeader2" column="SLR_ANCHOR_HEADER2" type="com.liferay.portal.dao.orm.hibernate.StringType" />
<property name="SlrAnchorText" column="SLR_ANCHOR_TEXT" type="com.liferay.portal.dao.orm.hibernate.StringType" />
<property name="SlrAnchorDesc" column="SLR_ANCHOR_DESC" type="com.liferay.portal.dao.orm.hibernate.StringType" />
</class>
<class name="slr.comment.model.impl.SlrDocumentStructureImpl" table="SLR_DOCUMENT_STRUCTURE">
<cache usage="read-write" />
<id name="SlrDocumentStructureId" column="SLR_DOCUMENT_STRUCTURE_ID" type="long">
<generator class="sequence">
<param name="sequence">SLR_DOCUMENT_STRUCTURE_SEQ</param>
</generator>
</id>
<property name="SlrDocumentTypId" column="SLR_DOCUMENT_TYP_ID" type="com.liferay.portal.dao.orm.hibernate.LongType" />
<property name="SlrAnchorId" column="SLR_ANCHOR_ID" type="com.liferay.portal.dao.orm.hibernate.LongType" />
</class>
<class name="slr.comment.model.impl.SlrCommentImpl" table="SLR_COMMENT">
<cache usage="read-write" />
<id name="SlrCommentId" column="SLR_COMMENT_ID" type="long">
<generator class="sequence">
<param name="sequence">SLR_COMMENT_SEQ</param>
</generator>
</id>
<property name="SlrDocumentId" column="SLR_DOCUMENT_ID" type="com.liferay.portal.dao.orm.hibernate.LongType" />
<property name="SlrAnchorId" column="SLR_ANCHOR_ID" type="com.liferay.portal.dao.orm.hibernate.LongType" />
<property name="SlrCommentTyp" column="SLR_COMMENT_TYP" type="com.liferay.portal.dao.orm.hibernate.StringType" />
<property name="SlrCommentOrder" column="SLR_COMMENT_ORDER" type="com.liferay.portal.dao.orm.hibernate.IntegerType" />
<property name="SlrCommentStatus" column="SLR_COMMENT_STATUS" type="com.liferay.portal.dao.orm.hibernate.StringType" />
<property name="SlrCommentText" column="SLR_COMMENT_TEXT" type="com.liferay.portal.dao.orm.hibernate.StringType" />
</class>
<class name="slr.comment.model.impl.SlrGraphImpl" table="SLR_GRAPH">
<cache usage="read-write" />
<id name="SlrGraphId" column="SLR_GRAPH_ID" type="long">
<generator class="sequence">
<param name="sequence">SLR_GRAPH_SEQ</param>
</generator>
</id>
<property name="SlrAnchorId" column="SLR_ANCHOR_ID" type="com.liferay.portal.dao.orm.hibernate.LongType" />
<property name="JSReportUnitId" column="JS_REPORT_UNIT_ID" type="com.liferay.portal.dao.orm.hibernate.LongType" />
</class>
</hibernate-mapping>
thumbnail
Michel Wicky,修改在12 年前。

RE: Exception sql produite par classe générée par service builder (答复)

Regular Member 帖子: 130 加入日期: 10-7-3 最近的帖子
I finally found the problem after i set log level DEBUG for org.hibernate. It was my error but i was confused by the name of the table in the error message.

Here is the generated SQL statement

20:16:42,288 DEBUG [SQL:111] select * from ( select slrdocumen0_.SLR_DOCUMENT_TYP_ID as SLR1_274_, slrdocumen0_.SLR_DOC_TYP_LABEL as SLR2_274_, slrdocumen0_.SLR_DOC_TYP_MAIN_TITLE as SLR3_274_, slrdocumen0_.SLR_DOC_TYP_SUB_TITLE as SLR4_274_, slrdocumen0_.SLR_DOC_TYP_DESC as SLR5_274_ from SLR_DOCUM
ENT_TYP slrdocumen0_ order by slrdocumen0_.SLR_DOC_TYP_LABEL ASC ) where rownum <= ?

My entity
<entity name="SlrDocumentTyp" table="SLR_DOCUMENT_TYP" local-service="true" data-source="slrDS" session-factory="slrSF" tx-manager="slrTX">
...
</entity>

I was surprised by the table name but it is correct after i have seen the SQL statement ... the problem was a mistyping in the column definition for the column SLR_DOC_TYP_SUB_TITLE !!!!

My fault ... but it was confusion without the sql statement displayed together with the error.