Erro de CGLIB ao dar um load com hibernate

3 respostas
T

bom dia atodos(apesar de ser segunda.... :lol: )

eu estou tendo um pequeno problema ao dar um session.load com o hibernate
net.sf.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of Produto.setDesc
	at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:212)
	at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:2199)
	at net.sf.hibernate.loader.Loader.doQuery(Loader.java:240)
	at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
	at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:836)
	at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:856)
	at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:59)
	at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:51)
	at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:419)
	at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2106)
	at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1980)
	at net.sf.hibernate.impl.SessionImpl.load(SessionImpl.java:1909)

ta acusando esse setDesc q é da classe produto....

public class Produto {
	
	private int ID;
	private String desc;
	private double preco;
	
	Produto(){
		//padrão ser vazio
	}
	public void setDesc(String desc){
		this.desc = desc;
	}
	public String getDesc(){
		return desc;
	}

//outros sets e gets....
o hbm.xml ta assim....
<property name="desc"  column="DESCRICAO" type="char"/>
<!-- ja tentei colocar algo como char(50), que é o tamanho que esta especificado no banco, mas nao rolou tambem... -->

ele ta inserindo blz, mas ta dando esse problema na hora de recuperar o dado....

alguem pode me ajudar!?
valeu!

3 Respostas

R

Tem como vc colocar todo o printStackTrace() da sua aplicação e o HBM ?

T
"rafabene":
Tem como vc colocar todo o printStackTrace() da sua aplicação e o HBM ?
2004-05-31 10:23:07,182 INFO  hibernate.cfg.Environment  -> Hibernate 2.1.3
 2004-05-31 10:23:07,563 INFO  hibernate.cfg.Environment  -> loaded properties from resource hibernate.properties: {hibernate.connection.username=expressacinq, hibernate.connection.password=ecinq, hibernate.cglib.use_reflection_optimizer=true, hibernate.dialect=net.sf.hibernate.dialect.SQLServerDialect, hibernate.connection.url=jdbc:microsoft:sqlserver://192.168.227.201:1433;DatabaseName=ENTREGAEXPRESSA, hibernate.connection.driver_class=com.microsoft.jdbc.sqlserver.SQLServerDriver}
 2004-05-31 10:23:07,703 INFO  hibernate.cfg.Environment  -> using CGLIB reflection optimizer
 2004-05-31 10:23:07,973 INFO  hibernate.cfg.Configuration  -> Mapping resource: Produto.hbm.xml
 2004-05-31 10:23:14,753 DEBUG hibernate.util.DTDEntityResolver  -> trying to locate http://hibernate.sourceforge.net/hibernate-mapping.dtd in classpath under net/sf/hibernate/
 2004-05-31 10:23:14,763 DEBUG hibernate.util.DTDEntityResolver  -> http://hibernate.sourceforge.net/hibernate-mapping.dtdnot found in classpath
 2004-05-31 10:23:17,727 INFO  hibernate.cfg.Binder  -> Mapping class: Produto -> TB_PRODUTO
 2004-05-31 10:23:18,949 DEBUG hibernate.cfg.Binder  -> Mapped property: ID -> id, type: integer
 2004-05-31 10:23:19,179 DEBUG hibernate.cfg.Binder  -> Mapped property: desc -> DESCRICAO, type: character
 2004-05-31 10:23:19,189 DEBUG hibernate.cfg.Binder  -> Mapped property: preco -> PRECO, type: double
 2004-05-31 10:23:19,199 INFO  hibernate.cfg.Configuration  -> processing one-to-many association mappings
 2004-05-31 10:23:19,209 INFO  hibernate.cfg.Configuration  -> processing one-to-one association property references
 2004-05-31 10:23:19,390 INFO  hibernate.cfg.Configuration  -> processing foreign key constraints
 2004-05-31 10:23:19,780 INFO  hibernate.dialect.Dialect  -> Using dialect: net.sf.hibernate.dialect.SQLServerDialect
 2004-05-31 10:23:19,810 INFO  hibernate.cfg.SettingsFactory  -> Use outer join fetching: true
 2004-05-31 10:23:19,950 INFO  hibernate.connection.DriverManagerConnectionProvider  -> Using Hibernate built-in connection pool (not for production use!)
 2004-05-31 10:23:19,950 INFO  hibernate.connection.DriverManagerConnectionProvider  -> Hibernate connection pool size: 20
 2004-05-31 10:23:20,111 INFO  hibernate.connection.DriverManagerConnectionProvider  -> using driver: com.microsoft.jdbc.sqlserver.SQLServerDriver at URL: jdbc:microsoft:sqlserver://192.168.227.201:1433;DatabaseName=ENTREGAEXPRESSA
 2004-05-31 10:23:20,121 INFO  hibernate.connection.DriverManagerConnectionProvider  -> connection properties: {user=expressacinq, password=ecinq}
 2004-05-31 10:23:20,251 INFO  hibernate.transaction.TransactionManagerLookupFactory  -> No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
 2004-05-31 10:23:20,281 DEBUG hibernate.connection.DriverManagerConnectionProvider  -> total checked-out connections: 0
 2004-05-31 10:23:20,291 DEBUG hibernate.connection.DriverManagerConnectionProvider  -> opening new JDBC connection
 2004-05-31 10:23:21,953 DEBUG hibernate.connection.DriverManagerConnectionProvider  -> created connection to: jdbc:microsoft:sqlserver://192.168.227.201:1433;DatabaseName=ENTREGAEXPRESSA, Isolation Level: 2
 2004-05-31 10:23:22,264 DEBUG hibernate.connection.DriverManagerConnectionProvider  -> returning connection to pool, pool size: 1
 2004-05-31 10:23:22,274 INFO  hibernate.cfg.SettingsFactory  -> Use scrollable result sets: true
 2004-05-31 10:23:22,274 INFO  hibernate.cfg.SettingsFactory  -> Use JDBC3 getGeneratedKeys(): false
 2004-05-31 10:23:22,284 INFO  hibernate.cfg.SettingsFactory  -> Optimize cache for minimal puts: false
 2004-05-31 10:23:22,284 INFO  hibernate.cfg.SettingsFactory  -> Query language substitutions: {}
 2004-05-31 10:23:22,294 INFO  hibernate.cfg.SettingsFactory  -> cache provider: net.sf.ehcache.hibernate.Provider
 2004-05-31 10:23:22,444 INFO  hibernate.cfg.Configuration  -> instantiating and configuring caches
 2004-05-31 10:23:24,337 INFO  hibernate.impl.SessionFactoryImpl  -> building session factory
 2004-05-31 10:23:24,367 DEBUG hibernate.impl.SessionFactoryImpl  -> instantiating session factory with properties: {java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, hibernate.connection.password=ecinq, sun.boot.library.path=C:\Program Files\Java\j2re1.4.2_04\bin, java.vm.version=1.4.2_04-b05, hibernate.connection.username=expressacinq, java.vm.vendor=Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, path.separator=;, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, user.country=US, sun.os.patch.level=Service Pack 4, java.vm.specification.name=Java Virtual Machine Specification, user.dir=C:\tomcat\Servlet\Hib, java.runtime.version=1.4.2_04-b05, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.endorsed.dirs=C:\Program Files\Java\j2re1.4.2_04\lib\endorsed, os.arch=x86, java.io.tmpdir=C:\DOCUME~1\dalazen\LOCALS~1\Temp\, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows 2000, sun.java2d.fontpath=, java.library.path=C:\Program Files\Java\j2re1.4.2_04\bin;.;C:\WINNT\system32;C:\WINNT;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\WbemC:\PROGRA~1\Sybase\SQLANY~1\win32;;"C:\Program Files\Palm\JSync\1.3\rt\bin";C:\Nokia\Tools\Nokia_Developers_Suite_for_J2ME\bin;C:\Nokia\Update_Manager\bin, java.specification.name=Java Platform API Specification, java.class.version=48.0, java.util.prefs.PreferencesFactory=java.util.prefs.WindowsPreferencesFactory, os.version=5.0, user.home=C:\Documents and Settings\dalazen, user.timezone=GMT-03:00, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=Cp1252, java.specification.version=1.4, hibernate.connection.driver_class=com.microsoft.jdbc.sqlserver.SQLServerDriver, java.class.path=C:\tomcat\Servlet\Hib\lib\msbase.jar;C:\tomcat\Servlet\Hib\lib\msutil.jar;C:\tomcat\Servlet\Hib\lib\mssqlserver.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\hibernate2.jar;C:\tomcat\Servlet\Hib\classes;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\dom4j-1.4.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\log4j-1.2.8.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\commons-logging-1.0.3.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\ant-1.5.3.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\ant-optional-1.5.3.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\c3p0-0.8.4.5.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\cglib-full-2.0.1.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\commons-collections-2.1.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\commons-dbcp-1.1.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\commons-lang-1.0.1.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\commons-pool-1.1.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\concurrent-1.3.2.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\connector.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\ehcache-0.7.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\jaas.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\jboss-cache.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\jboss-common.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\jboss-jmx.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\jboss-system.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\jcs-1.0-dev.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\jdbc2_0-stdext.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\jgroups-2.2.1.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\jta.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\junit-3.8.1.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\odmg-3.0.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\oscache-2.0.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\proxool-0.8.3.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\swarmcache-1.0rc2.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\xalan-2.4.0.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\xerces-2.4.0.jar;C:\hibernate\hibernate-2.1.3\hibernate-2.1\lib\xml-apis.jar, user.name=dalazen, java.vm.specification.version=1.0, java.home=C:\Program Files\Java\j2re1.4.2_04, sun.arch.data.model=32, hibernate.dialect=net.sf.hibernate.dialect.SQLServerDialect, hibernate.connection.url=jdbc:microsoft:sqlserver://192.168.227.201:1433;DatabaseName=ENTREGAEXPRESSA, user.language=en, java.specification.vendor=Sun Microsystems Inc., awt.toolkit=sun.awt.windows.WToolkit, hibernate.cglib.use_reflection_optimizer=true, java.vm.info=mixed mode, java.version=1.4.2_04, java.ext.dirs=C:\Program Files\Java\j2re1.4.2_04\lib\ext, sun.boot.class.path=C:\Program Files\Java\j2re1.4.2_04\lib\rt.jar;C:\Program Files\Java\j2re1.4.2_04\lib\sunrsasign.jar;C:\Program Files\Java\j2re1.4.2_04\lib\jsse.jar;C:\Program Files\Java\j2re1.4.2_04\lib\jce.jar;C:\Program Files\Java\j2re1.4.2_04\lib\charsets.jar;C:\Program Files\Java\j2re1.4.2_04\lib\ext\dnsns.jar;C:\Program Files\Java\j2re1.4.2_04\lib\ext\ldapsec.jar;C:\Program Files\Java\j2re1.4.2_04\lib\ext\localedata.jar;C:\Program Files\Java\j2re1.4.2_04\lib\ext\sunjce_provider.jar, java.vendor=Sun Microsystems Inc., file.separator=\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, sun.cpu.isalist=pentium i486 i386}
 2004-05-31 10:23:29,244 DEBUG hibernate.impl.SessionFactoryObjectFactory  -> initializing class SessionFactoryObjectFactory
 2004-05-31 10:23:29,364 DEBUG hibernate.impl.SessionFactoryObjectFactory  -> registered: 4028634cfcdb3a7f00fcdb3a99340000 (unnamed)
 2004-05-31 10:23:29,364 INFO  hibernate.impl.SessionFactoryObjectFactory  -> no JNDI name configured
 2004-05-31 10:23:29,374 DEBUG hibernate.impl.SessionFactoryImpl  -> instantiated session factory
 2004-05-31 10:23:30,065 DEBUG hibernate.impl.SessionImpl  -> opened session
 2004-05-31 10:23:30,215 DEBUG hibernate.transaction.JDBCTransaction  -> begin
 2004-05-31 10:23:30,215 DEBUG hibernate.connection.DriverManagerConnectionProvider  -> total checked-out connections: 0
 2004-05-31 10:23:30,225 DEBUG hibernate.connection.DriverManagerConnectionProvider  -> using pooled JDBC connection, pool size: 0
 2004-05-31 10:23:30,225 DEBUG hibernate.transaction.JDBCTransaction  -> current autocommit status:false
 2004-05-31 10:23:30,395 DEBUG hibernate.impl.SessionImpl  -> saving [Produto#<null>]
 2004-05-31 10:23:30,395 DEBUG hibernate.impl.SessionImpl  -> executing insertions
 2004-05-31 10:23:30,435 DEBUG hibernate.persister.EntityPersister  -> Inserting entity: Produto (native id)
 2004-05-31 10:23:30,435 DEBUG hibernate.impl.BatcherImpl  -> about to open: 0 open PreparedStatements, 0 open ResultSets
 2004-05-31 10:23:30,445 DEBUG sf.hibernate.SQL  -> insert into TB_PRODUTO (DESCRICAO, PRECO) values (?, ?) select SCOPE_IDENTITY()
 2004-05-31 10:23:30,455 DEBUG hibernate.impl.BatcherImpl  -> preparing statement
 2004-05-31 10:23:31,347 DEBUG hibernate.persister.EntityPersister  -> Dehydrating entity: [Produto#<null>]
 2004-05-31 10:23:31,357 DEBUG hibernate.type.CharacterType  -> binding 'bala' to parameter: 1
 2004-05-31 10:23:31,637 DEBUG hibernate.type.DoubleType  -> binding '1.554' to parameter: 2
 2004-05-31 10:23:31,968 DEBUG hibernate.persister.AbstractEntityPersister  -> Natively generated identity: 48
 2004-05-31 10:23:31,968 DEBUG hibernate.impl.BatcherImpl  -> done closing: 0 open PreparedStatements, 0 open ResultSets
 2004-05-31 10:23:31,978 DEBUG hibernate.impl.BatcherImpl  -> closing statement
 2004-05-31 10:23:32,128 DEBUG hibernate.impl.SessionImpl  -> flushing session
 2004-05-31 10:23:32,148 DEBUG hibernate.impl.SessionImpl  -> Flushing entities and processing referenced collections
 2004-05-31 10:23:32,168 DEBUG hibernate.impl.SessionImpl  -> Processing unreferenced collections
 2004-05-31 10:23:32,168 DEBUG hibernate.impl.SessionImpl  -> Scheduling collection removes/(re)creates/updates
 2004-05-31 10:23:32,178 DEBUG hibernate.impl.SessionImpl  -> Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects
 2004-05-31 10:23:32,178 DEBUG hibernate.impl.SessionImpl  -> Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
 2004-05-31 10:23:32,338 DEBUG hibernate.impl.Printer  -> listing entities:
 2004-05-31 10:23:32,348 DEBUG hibernate.impl.Printer  -> Produto{preco=1.554, desc=bala, ID=48}
 2004-05-31 10:23:32,348 DEBUG hibernate.impl.SessionImpl  -> executing flush
 2004-05-31 10:23:32,358 DEBUG hibernate.impl.SessionImpl  -> post flush
 2004-05-31 10:23:32,368 DEBUG hibernate.transaction.JDBCTransaction  -> commit
 2004-05-31 10:23:32,368 DEBUG hibernate.impl.SessionImpl  -> flushing session
 2004-05-31 10:23:32,378 DEBUG hibernate.impl.SessionImpl  -> Flushing entities and processing referenced collections
 2004-05-31 10:23:32,378 DEBUG hibernate.impl.SessionImpl  -> Processing unreferenced collections
 2004-05-31 10:23:32,388 DEBUG hibernate.impl.SessionImpl  -> Scheduling collection removes/(re)creates/updates
 2004-05-31 10:23:32,388 DEBUG hibernate.impl.SessionImpl  -> Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects
 2004-05-31 10:23:32,398 DEBUG hibernate.impl.SessionImpl  -> Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
 2004-05-31 10:23:32,398 DEBUG hibernate.impl.Printer  -> listing entities:
 2004-05-31 10:23:32,408 DEBUG hibernate.impl.Printer  -> Produto{preco=1.554, desc=bala, ID=48}
 2004-05-31 10:23:32,408 DEBUG hibernate.impl.SessionImpl  -> executing flush
 2004-05-31 10:23:32,619 DEBUG hibernate.impl.SessionImpl  -> post flush
 2004-05-31 10:23:32,629 DEBUG hibernate.impl.SessionImpl  -> transaction completion
 2004-05-31 10:23:32,639 DEBUG hibernate.impl.SessionImpl  -> loading [Produto#20]
 2004-05-31 10:23:32,639 DEBUG hibernate.impl.SessionImpl  -> attempting to resolve [Produto#20]
 2004-05-31 10:23:32,649 DEBUG hibernate.impl.SessionImpl  -> object not resolved in any cache [Produto#20]
 2004-05-31 10:23:32,649 DEBUG hibernate.persister.EntityPersister  -> Materializing entity: [Produto#20]
 2004-05-31 10:23:32,679 DEBUG hibernate.impl.BatcherImpl  -> about to open: 0 open PreparedStatements, 0 open ResultSets
 2004-05-31 10:23:32,679 DEBUG sf.hibernate.SQL  -> select produto0_.id as id0_, produto0_.DESCRICAO as DESCRICAO0_, produto0_.PRECO as PRECO0_ from TB_PRODUTO produto0_ where produto0_.id=?
 2004-05-31 10:23:32,689 DEBUG hibernate.impl.BatcherImpl  -> preparing statement
 2004-05-31 10:23:32,889 DEBUG hibernate.type.IntegerType  -> binding '20' to parameter: 1
 2004-05-31 10:23:32,909 DEBUG hibernate.loader.Loader  -> processing result set
 2004-05-31 10:23:32,909 DEBUG hibernate.loader.Loader  -> result row: 20
 2004-05-31 10:23:32,919 DEBUG hibernate.loader.Loader  -> Initializing object from ResultSet: 20
 2004-05-31 10:23:32,919 DEBUG hibernate.loader.Loader  -> Hydrating entity: Produto#20
 2004-05-31 10:23:32,929 DEBUG hibernate.type.CharacterType  -> returning 'b' as column: DESCRICAO0_
 2004-05-31 10:23:32,939 DEBUG hibernate.type.DoubleType  -> returning '1.554' as column: PRECO0_
 2004-05-31 10:23:32,949 DEBUG hibernate.loader.Loader  -> done processing result set (1 rows)
 2004-05-31 10:23:32,949 DEBUG hibernate.impl.BatcherImpl  -> done closing: 0 open PreparedStatements, 0 open ResultSets
 2004-05-31 10:23:32,959 DEBUG hibernate.impl.BatcherImpl  -> closing statement
 2004-05-31 10:23:32,959 DEBUG hibernate.loader.Loader  -> total objects hydrated: 1
 2004-05-31 10:23:33,189 DEBUG hibernate.impl.SessionImpl  -> resolving associations for [Produto#20]
 net.sf.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of Produto.setDesc
	at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:212)
	at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:2199)
	at net.sf.hibernate.loader.Loader.doQuery(Loader.java:240)
	at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
	at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:836)
	at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:856)
	at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:59)
	at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:51)
	at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:419)
	at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2106)
	at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1980)
	at net.sf.hibernate.impl.SessionImpl.load(SessionImpl.java:1909)
	at GenericPersistence.retrieve(GenericPersistence.java:117)
	at InserrirTab.main(InserrirTab.java:76)
Caused by: net.sf.cglib.beans.BulkBeanException
	at Produto$$BulkBeanByCGLIB$$a257dc20.setPropertyValues(<generated>)
	at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:207)
	... 13 more
Caused by: java.lang.ClassCastException
	... 15 more
<?xml version="1.0"?> 
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping.dtd"> 
<hibernate-mapping> 
    <class name="Produto" table="TB_PRODUTO"> 
    	<id name="ID" type="int" column="id">
			<generator class="identity"/>
		</id>
        <property name="desc"  column="DESCRICAO" type="char(50)"/> 
        <property name="preco" column="PRECO" type="double"/> 
    </class> 
</hibernate-mapping>



       <!-- <id name="ID" column="ID" type="int"> 
            <generator class="assigned"/> 
        </id> 
        
        -->
        
        <!--Primary Key
        <id name="id" type="integer"
            unsaved-value="null">
            <column name="IDCATEG_DOC" sql-type="integer" not-null="true"/>
            <generator class="native">
    			<param name="sequence">G_CATEG_DOC</param>
			</generator>
        </id>
        -->

esta ai...
valeu!

T

descobri o problema !!! :lol:

ao inves de passar char no type no hbm , colquei string , com ‘s’ minusculo! e funcionou blz…

se alguem tiver um problema semelhante, essa é a solução!

flw

Criado 31 de maio de 2004
Ultima resposta 31 de mai. de 2004
Respostas 3
Participantes 2