Jahia and Sybase Issue
"rich aip" <[email protected]> Wed, 5 Dec 2007 13:16:03 -0500
| Newsgroups | gmane.comp.cms.jahia.install |
|---|---|
| Message-ID | <[email protected]> |
--===============1813612984==
Content-Type: multipart/alternative;
boundary="----=_Part_5209_29420634.1196878563537"
------=_Part_5209_29420634.1196878563537
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
I converted the Jahia build scripts over to Sybase and have some parts of
Jahia working. I am able to add additional pages and content. When I go to
the "WorkFlow" screen and press "Publish all Sites", the changes get
published but the log starts showing the following errors:
2007-12-05 11:25:27,609: ERROR [JahiaQuartzScheduler_Worker-0]
JDBCExceptionReporter, org.hibernate.util.JDBCExceptionReporter: Implicit
conversion from datatype 'VARCHAR' to 'INT' is not allowed. Use the CONVERT
function to run this query.
I think the following method is causing the problem:
JahiaFieldsDAO.findStagedFieldsByMetadataOwner(JahiaObjectPK ownerKey)
When the method calls template.find() the array of input parameters is the
JahiaObjectPK ID and type. The problem is with the ID. Internally the ID is
an integer but the getIDInType() is returning it as a java.lang.String.
In the HQL, the JahiaFieldsData.metadataOwnerId field is associated to the
"jahia_fields_data.id_jahia_obj" column which is an integer/number.
This seems to be a mismatch between parameter type and column type. That is,
the input parameter is a java.lang.String and the database column is an
integer.
When the SQL/parameters are pushed to Sybase in the
AbstractBatcher.getResultSet(PreparedStatement ps) method, it does not like
an input parameter of type String for an integer based column.
This creates the following exception: Implicit conversion from datatype
'VARCHAR' to 'INT' is not allowed. Use the CONVERT function to run this
query.
It seems that other databases like Oracle and MySql don't care and just
perform the conversion under the covers.
If my observations are correct, is there a way to get this to work
correctly?
Why not just pass the ID into the find() as an Integer? Why is it being
converted to a String?
I am using:
Jahia: 5.0.3_r18957
Sybase 15.0.2
** Method in Question **
public List findStagedFieldsByMetadataOwner(JahiaObjectPK ownerKey)
{
String hql = "select f.comp_id.id from JahiaFieldsData f where
f.metadataOwnerId=? AND
f.metadataOwnerType=? AND f.comp_id.workflowState>1";
final HibernateTemplate template = getHibernateTemplate();
template.setCacheQueries(false);
template.setFlushMode(HibernateTemplate.FLUSH_NEVER);
return template.find(hql, new Object[]{ownerKey.getIDInType(),
ownerKey.getType()});
}
------=_Part_5209_29420634.1196878563537
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"></span> </div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">I converted the Jahia build scripts over to Sybase and have some parts of Jahia working. I am able to add additional pages and content. When I go to the "WorkFlow" screen and press "Publish all Sites", the changes get published but the log starts showing the following errors:
</span></div>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"> </span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">2007-12-05 11:25:27,609: ERROR [JahiaQuartzScheduler_Worker-0] JDBCExceptionReporter, org.hibernate.util.JDBCExceptionReporter
: Implicit conversion from datatype 'VARCHAR' to 'INT' is not allowed.<span style="mso-spacerun: yes"> </span>Use the CONVERT function to run this query.</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"> </span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">I think the following method is causing the problem:</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">JahiaFieldsDAO.findStagedFieldsByMetadataOwner(JahiaObjectPK ownerKey) </span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"> </span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"> </span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">When the method calls template.find() the array of input parameters is the JahiaObjectPK ID and type. The problem is with the ID. Internally the ID is an integer but the getIDInType() is returning it as a
java.lang.String.</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"> </span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">In the HQL, the JahiaFieldsData.metadataOwnerId field is associated to the "jahia_fields_data.id_jahia_obj" column which is an integer/number.
</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"> </span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">This seems to be a mismatch between parameter type and column type. That is, the input parameter is a
java.lang.String and the database column is an integer.</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"> </span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">When the SQL/parameters are pushed to Sybase in the AbstractBatcher.getResultSet(PreparedStatement ps) method
</span><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">, it does not like an input parameter of type String for an integer based column.</span></p>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">This creates the following exception: Implicit conversion from datatype 'VARCHAR' to 'INT' is not allowed.
<span style="mso-spacerun: yes"> </span>Use the CONVERT function to run this query.</span></div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"></span> </div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">It seems that other databases like Oracle and MySql don't care and just perform the conversion under the covers.
</span></div>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"> </span></p>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">If my observations are correct, is there a way to get this to work correctly?</span></div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">Why not just pass the ID into the find() as an Integer? Why is it being converted to a String?
</span></div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"></span> </div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"></span> </div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">I am using:</span></div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">Jahia: 5.0.3_r18957</span></div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">Sybase 15.0.2 </span></div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"></span> </div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"></span> </div>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">** Method in Question **</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">public List findStagedFieldsByMetadataOwner(JahiaObjectPK ownerKey) </span></p>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">{</span></div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"> </span><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">
String hql = "select f.comp_id.id from JahiaFieldsData f where f.metadataOwnerId=? AND </span></div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"> f.metadataOwnerType=? AND f.comp_id.workflowState>1";</span></div>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"> final HibernateTemplate template = getHibernateTemplate();</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"> template.setCacheQueries(false);</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"> template.setFlushMode(HibernateTemplate.FLUSH_NEVER);</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"> return template.find(hql, new Object[]{ownerKey.getIDInType(), ownerKey.getType()});</span>
</p>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">}</span></div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"></span> </div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"></span> </div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"></span> </div>
------=_Part_5209_29420634.1196878563537--
--===============1813612984==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
install_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/install_list
--===============1813612984==--