|
|||||||
![]() |
|
|
Thread Tools | Search this Thread |
|
#1
|
|||
|
|||
|
I am pulling my hair out already.
I want to use existing hibernate beans, because I want to expand POJOS with business logic for my domain. I prefer to stick to hibernate rather than SQL servertype. I have gotten stuck with the long <-> integer hibernate issue. I set all datatypes to be explicitly long, but I still get the error. Where is the integer? Here is a very simple example that I try to get running, to no avail: Entry.gwt.xml Code:
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.6//EN"
"http://google-web-toolkit.googlecode.com/svn/releases/1.6/distro-source/core/src/gwt-module.dtd">
<module rename-to="reg">
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.smartgwtee.SmartGwtEE'/>
<inherits name="com.smartgwtee.tools.Tools"/>
<entry-point class='bg.enf.reg.client.Entry'/>
</module>
Code:
package bg.enf.reg.client;
import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.layout.VLayout;
public class Entry implements EntryPoint {
public void onModuleLoad() {
DataSource dataSource = DataSource.get("Person__Grid");
//the order items list grid
final ListGrid orderItemsList = new ListGrid();
//the order list grid
ListGrid ordersList = new ListGrid();
ordersList.setHeight(170);
ordersList.setWidth(500);
ordersList.setDataSource(dataSource);
ordersList.setAutoFetchData(true);
ListGridField fldName = new ListGridField("name");
fldName.setWidth("100%");
ordersList.setFields(fldName);
VLayout layout = new VLayout(5);
layout.setWidth(500);
layout.addMember(ordersList);
layout.draw();
}
}
Code:
DROP TABLE IF EXISTS `enfserver`.`person`; CREATE TABLE `enfserver`.`person` ( `personid` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, PRIMARY KEY (`personid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="bg.enf.reg.domain.Person" table="person" catalog="enfserver">
<id name="personid" type="java.lang.Long">
<generator class="native"/>
</id>
<property name="name" type="string"/>
</class>
</hibernate-mapping>
Code:
package bg.enf.reg.domain;
import java.io.Serializable;
public class Person implements Serializable {
protected Long personid;
public Long getPersonid() {
return personid;
}
public void setPersonid(Long personid) {
this.personid = personid;
}
protected String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
Code:
<DataSource ID="Person__Grid" serverType="hibernate" tablename="person" beanClassName="bg.enf.reg.domain.Person">
<fields>
<field name="personid" type="sequence" primaryKey="true" hidden="true" />
<field name="name" type="text" title="Name"/>
</fields>
</DataSource>
Code:
=== 2010-03-14 16:09:56,234 [80-1] DEBUG RPCManager - Processing 1 requests.
=== 2010-03-14 16:09:56,250 [80-1] DEBUG RPCManager - Request #1 (DSRequest) payload: {
criteria:{
},
operationConfig:{
dataSource:"Person__Grid",
operationType:"fetch",
textMatchStyle:"substring"
},
startRow:0,
endRow:75,
componentId:"isc_OID_1",
appID:"builtinApplication",
operation:"Person__Grid_fetch",
oldValues:{
}
}
=== 2010-03-14 16:09:56,250 [80-1] INFO IDACall - Performing 1 operation(s)
=== 2010-03-14 16:09:56,265 [80-1] DEBUG AppBase - [builtinApplication.Person__Grid_fetch] No userTypes defined, allowing anyone access to all operations for this application
=== 2010-03-14 16:09:56,265 [80-1] DEBUG AppBase - [builtinApplication.Person__Grid_fetch] No public zero-argument method named '_Person__Grid_fetch' found, performing generic datasource operation
=== 2010-03-14 16:09:56,265 [80-1] INFO HibernateDataSource - [builtinApplication.Person__Grid_fetch] Performing fetch operation with
criteria: {} values: {}
Hibernate:
select
count(*) as y0_
from
enfserver.person this_
Hibernate:
select
count(*) as y0_
from
enfserver.person this_
=== 2010-03-14 16:09:56,390 [80-1] WARN RequestContext - dsRequest.execute() failed:
java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
at com.isomorphic.hibernate.HibernateDataSource.buildCriteria(HibernateDataSource.java:823)
at com.isomorphic.hibernate.HibernateDataSource.execute(HibernateDataSource.java:515)
at com.isomorphic.application.AppBase.executeDefaultDSOperation(AppBase.java:721)
at com.isomorphic.application.AppBase.executeAppOperation(AppBase.java:658)
at com.isomorphic.application.AppBase.execute(AppBase.java:491)
at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:1250)
at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:155)
at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:106)
at com.isomorphic.servlet.IDACall.doPost(IDACall.java:54)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)
=== 2010-03-14 16:09:56,390 [80-1] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
=== 2010-03-14 16:09:56,390 [80-1] DEBUG RPCManager - non-DMI response, dropExtraFields: false
Last edited by vmihaylov; 14th Mar 2010 at 09:28.. |
|
#2
|
|||
|
|||
|
I used the all libraries provided with the smartgwt distribution, along with a separate gwt and mysql connector libraries.
This resolved the error. Hopefully haven't wasted resources on your part :) |