romarcio 24 de ago. de 2010
Edita seu post e coloca o código e o log entre as tags CODE. No editor de texto tem um botão chamado CODE, seleciona o código e clica nele. Fica melhor a visuaçização.
Seu problema é esse: Caused by: org.hibernate.HibernateException: /hibernate.cfg.xml not found
Seu arquivo hibernate.cfg.xml não está sendo encontrado pelo hibernate.
Onde vc colocou ele? Deve ficar na raiz da pasta que contém os fontes.
dymitrios 25 de ago. de 2010
Perdão não sabia disso…
Então agora o erro mudou… continuo sem saber o que fazer…
25 / 08 / 2010 09 : 56 : 53 or g . hibernate . cfg . annotations . Version < clinit >
INFO : Hibernate Annotations 3.3.1. GA
25 / 08 / 2010 09 : 56 : 53 or g . hibernate . cfg . Environment < clinit >
INFO : Hibernate 3.2.5
25 / 08 / 2010 09 : 56 : 53 or g . hibernate . cfg . Environment < clinit >
INFO : hibernate . properties not found
25 / 08 / 2010 09 : 56 : 53 or g . hibernate . cfg . Environment buildBytecodeProvider
INFO : Bytecode provider name : cglib
25 / 08 / 2010 09 : 56 : 53 or g . hibernate . cfg . Environment < clinit >
INFO : using JDK 1.4 java . sql . Timestamp handling
25 / 08 / 2010 09 : 56 : 53 or g . hibernate . cfg . Configuration configure
INFO : configuring from resource : / hibernate . cfg . xml
25 / 08 / 2010 09 : 56 : 53 or g . hibernate . cfg . Configuration get ConfigurationInputStream
INFO : Configuration resource : / hibernate . cfg . xml
25 / 08 / 2010 09 : 56 : 53 or g . hibernate . cfg . Configuration addResource
INFO : Read ing mappings from resource : hibernate / Consultas . hbm . xml
25 / 08 / 2010 09 : 56 : 53 or g . hibernate . cfg . Configuration addResource
INFO : Read ing mappings from resource : hibernate / ResultadoConsultas . hbm . xml
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . Configuration doConfigure
INFO : Configured SessionFactory : null
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . HbmBinder bindRootPersistentClassCommonValues
INFO : Mapping class : hibernate . Consultas -> consultas
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . HbmBinder bindRootPersistentClassCommonValues
INFO : Mapping class : hibernate . ResultadoConsultas -> resultado_consultas
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . AnnotationConfiguration secondPassCompile
INFO : Hibernate Val idator not found : ignoring
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . connection . DriverManagerConnectionProvider configure
INFO : Using Hibernate built - in connection pool ( not for production use ! )
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . connection . DriverManagerConnectionProvider configure
INFO : Hibernate connection pool size : 20
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . connection . DriverManagerConnectionProvider configure
INFO : autocommit mode : false
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . connection . DriverManagerConnectionProvider configure
INFO : using driver : com . mysql . jdbc . Driver at URL : jdbc : mysql : // localhost : 3306 / credtudo
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . connection . DriverManagerConnectionProvider configure
INFO : connection properties : { user = root , password =**** }
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . SettingsFactory buildSettings
INFO : RDBMS : MySQL , version : 5.1.49 - community
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . SettingsFactory buildSettings
INFO : JDBC driver : MySQL - AB JDBC Driver , version : mysql - connector - java - 5.1.6 ( Revision : ${ svn . Revision } )
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . dialect . Dialect < init >
INFO : Using dialect : or g . hibernate . dialect . MySQLDialect
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . transaction . TransactionFactoryFactory buildTransactionFactory
INFO : Using def ault transaction strategy ( direct JDBC transactions )
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . transaction . TransactionManagerLookupFactory get TransactionManagerLookup
INFO : No TransactionManagerLookup configured ( in JTA environment , use of read - write or transactional second - level cache is not recommended )
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . SettingsFactory buildSettings
INFO : Automatic flush during beforeCompletion (): disabled
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . SettingsFactory buildSettings
INFO : Automatic session close at end of transaction : disabled
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . SettingsFactory buildSettings
INFO : JDBC batch size : 15
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . SettingsFactory buildSettings
INFO : JDBC batch updates for versioned data : disabled
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . SettingsFactory buildSettings
INFO : Scrollable result sets : enabled
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . SettingsFactory buildSettings
INFO : JDBC3 get GeneratedKeys (): enabled
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . SettingsFactory buildSettings
INFO : Connection release mode : auto
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . SettingsFactory buildSettings
INFO : Maximum outer join fetch depth : 2
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . SettingsFactory buildSettings
INFO : Def ault batch fetch size : 1
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . SettingsFactory buildSettings
INFO : Generate SQL with comments : disabled
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . SettingsFactory buildSettings
INFO : Or der SQL updates by primary key : disabled
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . SettingsFactory buildSettings
INFO : Or der SQL inserts for batching : disabled
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . SettingsFactory createQueryTranslatorFactory
INFO : Query translator : or g . hibernate . hql . ast . ASTQueryTranslatorFactory
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . hql . ast . ASTQueryTranslatorFactory < init >
INFO : Using ASTQueryTranslatorFactory
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . SettingsFactory buildSettings
INFO : Query language substitutions : {}
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . SettingsFactory buildSettings
INFO : JPA - QL strict compliance : disabled
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . SettingsFactory buildSettings
INFO : Second - level cache : enabled
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . SettingsFactory buildSettings
INFO : Query cache : disabled
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . SettingsFactory createCacheProvider
INFO : Cache provider : or g . hibernate . cache . NoCacheProvider
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . SettingsFactory buildSettings
INFO : Optimize cache for minimal puts : disabled
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . SettingsFactory buildSettings
INFO : Structured second - level cache entries : disabled
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . SettingsFactory buildSettings
INFO : Statistics : disabled
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . SettingsFactory buildSettings
INFO : Deleted entity synthetic identifier rollback : disabled
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . SettingsFactory buildSettings
INFO : Def ault entity - mode : pojo
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . cfg . SettingsFactory buildSettings
INFO : Named query checking : enabled
25 / 08 / 2010 09 : 56 : 54 or g . hibernate . impl . SessionFactoryImpl < init >
INFO : building session factory
25 / 08 / 2010 09 : 56 : 55 or g . hibernate . impl . SessionFactoryObjectFactory addInstance
INFO : Not binding factory to JNDI , no JNDI name configured
25 / 08 / 2010 09 : 56 : 55 credserver . ServerCredTudo run
GRAVE : null
or g . hibernate . HibernateException : No CurrentSessionContext configured !
transferido ...
at or g . hibernate . impl . SessionFactoryImpl . get CurrentSession ( SessionFactoryImpl . java : 542 )
at credserver . DAOS . DAOconsultas . salvar ( DAOconsultas . java : 27 )
at credserver . ServerCredTudo . run ( ServerCredTudo . java : 115 )
romarcio 25 de ago. de 2010
Adicione esse linha no seu arquivo hibernate.cfg.xml: <property name="current_session_context_class">thread</property>
dymitrios 25 de ago. de 2010
Cara mudou o erro… mas agora acredito que seja o valor NULL de alguns campos da tabela…
Vou inserir valores… acredito que já corrige…
Muito Obrigado mesmo viu…
run :
25 /08/ 2010 10 : 56 : 08 org . hibernate . cfg . annotations . Version < clinit >
INFO : Hibernate Annotations 3.3 . 1 . GA
25 /08/ 2010 10 : 56 : 08 org . hibernate . cfg . Environment < clinit >
INFO : Hibernate 3.2 . 5
25 /08/ 2010 10 : 56 : 08 org . hibernate . cfg . Environment < clinit >
INFO : hibernate . properties not found
25 /08/ 2010 10 : 56 : 08 org . hibernate . cfg . Environment buildBytecodeProvider
INFO : Bytecode provider name : cglib
25 /08/ 2010 10 : 56 : 08 org . hibernate . cfg . Environment < clinit >
INFO : using JDK 1.4 java . sql . Timestamp handling
25 /08/ 2010 10 : 56 : 08 org . hibernate . cfg . Configuration configure
INFO : configuring from resource : / hibernate . cfg . xml
25 /08/ 2010 10 : 56 : 08 org . hibernate . cfg . Configuration getConfigurationInputStream
INFO : Configuration resource : / hibernate . cfg . xml
25 /08/ 2010 10 : 56 : 08 org . hibernate . cfg . Configuration addResource
INFO : Reading mappings from resource : hibernate / Consultas . hbm . xml
25 /08/ 2010 10 : 56 : 08 org . hibernate . cfg . Configuration addResource
INFO : Reading mappings from resource : hibernate / ResultadoConsultas . hbm . xml
25 /08/ 2010 10 : 56 : 08 org . hibernate . cfg . Configuration doConfigure
INFO : Configured SessionFactory : null
25 /08/ 2010 10 : 56 : 08 org . hibernate . cfg . HbmBinder bindRootPersistentClassCommonValues
INFO : Mapping class : hibernate . Consultas -> consultas
25 /08/ 2010 10 : 56 : 08 org . hibernate . cfg . HbmBinder bindRootPersistentClassCommonValues
INFO : Mapping class : hibernate . ResultadoConsultas -> resultado_consultas
25 /08/ 2010 10 : 56 : 08 org . hibernate . cfg . AnnotationConfiguration secondPassCompile
INFO : Hibernate Validator not found : ignoring
25 /08/ 2010 10 : 56 : 08 org . hibernate . connection . DriverManagerConnectionProvider configure
INFO : Using Hibernate built - in connection pool ( not for production use !)
25 /08/ 2010 10 : 56 : 08 org . hibernate . connection . DriverManagerConnectionProvider configure
INFO : Hibernate connection pool size : 20
25 /08/ 2010 10 : 56 : 08 org . hibernate . connection . DriverManagerConnectionProvider configure
INFO : autocommit mode : false
25 /08/ 2010 10 : 56 : 08 org . hibernate . connection . DriverManagerConnectionProvider configure
INFO : using driver : com . mysql . jdbc . Driver at URL : jdbc : mysql :// localhost : 3306 / credtudo
25 /08/ 2010 10 : 56 : 08 org . hibernate . connection . DriverManagerConnectionProvider configure
INFO : connection properties : { user = root , password =****}
25 /08/ 2010 10 : 56 : 08 org . hibernate . cfg . SettingsFactory buildSettings
INFO : RDBMS : MySQL , version : 5.1 . 49 - community
25 /08/ 2010 10 : 56 : 08 org . hibernate . cfg . SettingsFactory buildSettings
INFO : JDBC driver : MySQL - AB JDBC Driver , version : mysql - connector - java - 5.1 . 6 ( Revision : $ { svn . Revision } )
25 /08/ 2010 10 : 56 : 08 org . hibernate . dialect . Dialect < init >
INFO : Using dialect : org . hibernate . dialect . MySQLDialect
25 /08/ 2010 10 : 56 : 08 org . hibernate . transaction . TransactionFactoryFactory buildTransactionFactory
INFO : Using default transaction strategy ( direct JDBC transactions )
25 /08/ 2010 10 : 56 : 08 org . hibernate . transaction . TransactionManagerLookupFactory getTransactionManagerLookup
INFO : No TransactionManagerLookup configured ( in JTA environment , use of read - write or transactional second - level cache is not recommended )
25 /08/ 2010 10 : 56 : 08 org . hibernate . cfg . SettingsFactory buildSettings
INFO : Automatic flush during beforeCompletion (): disabled
25 /08/ 2010 10 : 56 : 08 org . hibernate . cfg . SettingsFactory buildSettings
INFO : Automatic session close at end of transaction : disabled
25 /08/ 2010 10 : 56 : 08 org . hibernate . cfg . SettingsFactory buildSettings
INFO : JDBC batch size : 15
25 /08/ 2010 10 : 56 : 08 org . hibernate . cfg . SettingsFactory buildSettings
INFO : JDBC batch updates for versioned data : disabled
25 /08/ 2010 10 : 56 : 08 org . hibernate . cfg . SettingsFactory buildSettings
INFO : Scrollable result sets : enabled
25 /08/ 2010 10 : 56 : 08 org . hibernate . cfg . SettingsFactory buildSettings
INFO : JDBC3 getGeneratedKeys (): enabled
25 /08/ 2010 10 : 56 : 09 org . hibernate . cfg . SettingsFactory buildSettings
INFO : Connection release mode : auto
25 /08/ 2010 10 : 56 : 09 org . hibernate . cfg . SettingsFactory buildSettings
INFO : Maximum outer join fetch depth : 2
25 /08/ 2010 10 : 56 : 09 org . hibernate . cfg . SettingsFactory buildSettings
INFO : Default batch fetch size : 1
25 /08/ 2010 10 : 56 : 09 org . hibernate . cfg . SettingsFactory buildSettings
INFO : Generate SQL with comments : disabled
25 /08/ 2010 10 : 56 : 09 org . hibernate . cfg . SettingsFactory buildSettings
INFO : Order SQL updates by primary key : disabled
25 /08/ 2010 10 : 56 : 09 org . hibernate . cfg . SettingsFactory buildSettings
INFO : Order SQL inserts for batching : disabled
25 /08/ 2010 10 : 56 : 09 org . hibernate . cfg . SettingsFactory createQueryTranslatorFactory
INFO : Query translator : org . hibernate . hql . ast . ASTQueryTranslatorFactory
25 /08/ 2010 10 : 56 : 09 org . hibernate . hql . ast . ASTQueryTranslatorFactory < init >
INFO : Using ASTQueryTranslatorFactory
25 /08/ 2010 10 : 56 : 09 org . hibernate . cfg . SettingsFactory buildSettings
INFO : Query language substitutions : {}
25 /08/ 2010 10 : 56 : 09 org . hibernate . cfg . SettingsFactory buildSettings
INFO : JPA - QL strict compliance : disabled
25 /08/ 2010 10 : 56 : 09 org . hibernate . cfg . SettingsFactory buildSettings
INFO : Second - level cache : enabled
25 /08/ 2010 10 : 56 : 09 org . hibernate . cfg . SettingsFactory buildSettings
INFO : Query cache : disabled
25 /08/ 2010 10 : 56 : 09 org . hibernate . cfg . SettingsFactory createCacheProvider
INFO : Cache provider : org . hibernate . cache . NoCacheProvider
25 /08/ 2010 10 : 56 : 09 org . hibernate . cfg . SettingsFactory buildSettings
INFO : Optimize cache for minimal puts : disabled
25 /08/ 2010 10 : 56 : 09 org . hibernate . cfg . SettingsFactory buildSettings
INFO : Structured second - level cache entries : disabled
25 /08/ 2010 10 : 56 : 09 org . hibernate . cfg . SettingsFactory buildSettings
INFO : Statistics : disabled
25 /08/ 2010 10 : 56 : 09 org . hibernate . cfg . SettingsFactory buildSettings
INFO : Deleted entity synthetic identifier rollback : disabled
25 /08/ 2010 10 : 56 : 09 org . hibernate . cfg . SettingsFactory buildSettings
INFO : Default entity - mode : pojo
25 /08/ 2010 10 : 56 : 09 org . hibernate . cfg . SettingsFactory buildSettings
INFO : Named query checking : enabled
25 /08/ 2010 10 : 56 : 09 org . hibernate . impl . SessionFactoryImpl < init >
INFO : building session factory
25 /08/ 2010 10 : 56 : 09 org . hibernate . impl . SessionFactoryObjectFactory addInstance
INFO : Not binding factory to JNDI , no JNDI name configured
25 /08/ 2010 10 : 56 : 09 credserver . ServerCredTudo run
GRAVE : null
org . hibernate . PropertyValueException : not - null property references a null or transient value : hibernate . Consultas . tipoConsulta
at org . hibernate . engine . Nullability . checkNullability ( Nullability . java : 72 )
at org . hibernate . event . def . AbstractSaveEventListener . performSaveOrReplicate ( AbstractSaveEventListener . java : 290 )
at org . hibernate . event . def . AbstractSaveEventListener . performSave ( AbstractSaveEventListener . java : 181 )
at org . hibernate . event . def . AbstractSaveEventListener . saveWithGeneratedId ( AbstractSaveEventListener . java : 107 )
at org . hibernate . event . def . DefaultSaveOrUpdateEventListener . saveWithGeneratedOrRequestedId ( DefaultSaveOrUpdateEventListener . java : 187 )
at org . hibernate . event . def . DefaultSaveOrUpdateEventListener . entityIsTransient ( DefaultSaveOrUpdateEventListener . java : 172 )
at org . hibernate . event . def . DefaultSaveOrUpdateEventListener . performSaveOrUpdate ( DefaultSaveOrUpdateEventListener . java : 94 )
at org . hibernate . event . def . DefaultSaveOrUpdateEventListener . onSaveOrUpdate ( DefaultSaveOrUpdateEventListener . java : 70 )
at org . hibernate . impl . SessionImpl . fireSaveOrUpdate ( SessionImpl . java : 507 )
at org . hibernate . impl . SessionImpl . saveOrUpdate ( SessionImpl . java : 499 )
at org . hibernate . impl . SessionImpl . saveOrUpdate ( SessionImpl . java : 495 )
at sun . reflect . NativeMethodAccessorImpl . invoke0 ( Native Method )
at sun . reflect . NativeMethodAccessorImpl . invoke ( NativeMethodAccessorImpl . java : 39 )
at sun . reflect . DelegatingMethodAccessorImpl . invoke ( DelegatingMethodAccessorImpl . java : 25 )
at java . lang . reflect . Method . invoke ( Method . java : 597 )
at org . hibernate . context . ThreadLocalSessionContext $TransactionProtectionWrapper . invoke ( ThreadLocalSessionContext . java : 301 )
at $Proxy0 . saveOrUpdate ( Unknown Source )
transferido ...
at credserver . DAOS . DAOconsultas . salvar ( DAOconsultas . java : 31 )
at credserver . ServerCredTudo . run ( ServerCredTudo . java : 115 )
dymitrios 25 de ago. de 2010
Boa tarde a todos.
Que espécie de erro é esse???
Erro:org.hibernate.PropertyValueException: not-null property references a null or transient value: hibernate.Consultas.tipoConsulta
romarcio 25 de ago. de 2010
Coloca ai o mapeamento e a classe Consultas.
dymitrios 25 de ago. de 2010
Na Tabela Consultas no BD.
O campo TipoConsultas é char(2).
E aqui está String… não sei como colocar char(2) no java. nem sei se tem como.
Classe Consultas
import java.util.Date ;
/**
* Consultas generated by hbm2java
*/
public class Consultas implements java . io . Serializable {
private Integer codigo ;
private String tipoConsulta ;
private String itemConsultado ;
private String valorItem ;
private String valorItem2 ;
private String valorItem3 ;
private int codCliente ;
private short codAtendente ;
private Date data ;
private Date hora ;
private Date horaConc ;
private char motivo ;
private int idFaturamento ;
private char excluido ;
private String usuarioExcluido ;
private char ocultar ;
public Consultas () {
}
public Consultas ( String tipoConsulta , String itemConsultado , String valorItem , String valorItem2 , String valorItem3 , int codCliente , short codAtendente , Date data , Date hora , Date horaConc , char motivo , int idFaturamento , char excluido , String usuarioExcluido , char ocultar ) {
this . tipoConsulta = tipoConsulta ;
this . itemConsultado = itemConsultado ;
this . valorItem = valorItem ;
this . valorItem2 = valorItem2 ;
this . valorItem3 = valorItem3 ;
this . codCliente = codCliente ;
this . codAtendente = codAtendente ;
this . data = data ;
this . hora = hora ;
this . horaConc = horaConc ;
this . motivo = motivo ;
this . idFaturamento = idFaturamento ;
this . excluido = excluido ;
this . usuarioExcluido = usuarioExcluido ;
this . ocultar = ocultar ;
}
public Integer getCodigo () {
return this . codigo ;
}
public void setCodigo ( Integer codigo ) {
this . codigo = codigo ;
}
public String getTipoConsulta () {
return this . tipoConsulta ;
}
public void setTipoConsulta ( String tipoConsulta ) {
this . tipoConsulta = tipoConsulta ;
}
public String getItemConsultado () {
return this . itemConsultado ;
}
public void setItemConsultado ( String itemConsultado ) {
this . itemConsultado = itemConsultado ;
}
public String getValorItem () {
return this . valorItem ;
}
public void setValorItem ( String valorItem ) {
this . valorItem = valorItem ;
}
public String getValorItem2 () {
return this . valorItem2 ;
}
public void setValorItem2 ( String valorItem2 ) {
this . valorItem2 = valorItem2 ;
}
public String getValorItem3 () {
return this . valorItem3 ;
}
public void setValorItem3 ( String valorItem3 ) {
this . valorItem3 = valorItem3 ;
}
public int getCodCliente () {
return this . codCliente ;
}
public void setCodCliente ( int codCliente ) {
this . codCliente = codCliente ;
}
public short getCodAtendente () {
return this . codAtendente ;
}
public void setCodAtendente ( short codAtendente ) {
this . codAtendente = codAtendente ;
}
public Date getData () {
return this . data ;
}
public void setData ( Date data ) {
this . data = data ;
}
public Date getHora () {
return this . hora ;
}
public void setHora ( Date hora ) {
this . hora = hora ;
}
public Date getHoraConc () {
return this . horaConc ;
}
public void setHoraConc ( Date horaConc ) {
this . horaConc = horaConc ;
}
public char getMotivo () {
return this . motivo ;
}
public void setMotivo ( char motivo ) {
this . motivo = motivo ;
}
public int getIdFaturamento () {
return this . idFaturamento ;
}
public void setIdFaturamento ( int idFaturamento ) {
this . idFaturamento = idFaturamento ;
}
public char getExcluido () {
return this . excluido ;
}
public void setExcluido ( char excluido ) {
this . excluido = excluido ;
}
public String getUsuarioExcluido () {
return this . usuarioExcluido ;
}
public void setUsuarioExcluido ( String usuarioExcluido ) {
this . usuarioExcluido = usuarioExcluido ;
}
public char getOcultar () {
return this . ocultar ;
}
public void setOcultar ( char ocultar ) {
this . ocultar = ocultar ;
}
}
Mapeamento Da Classe Consultas
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 25/08/2010 14:33:53 by Hibernate Tools 3.2.1.GA -->
<hibernate-mapping>
<class name= "hibernate.Consultas" table= "consultas" catalog= "credtudo" >
<id name= "codigo" type= "java.lang.Integer" >
<column name= "Codigo" />
<generator class= "identity" />
</id>
<property name= "tipoConsulta" type= "string" >
<column name= "TipoConsulta" length= "2" not-null= "true" />
</property>
<property name= "itemConsultado" type= "string" >
<column name= "ItemConsultado" length= "20" not-null= "true" />
</property>
<property name= "valorItem" type= "string" >
<column name= "ValorItem" length= "25" not-null= "true" />
</property>
<property name= "valorItem2" type= "string" >
<column name= "ValorItem2" length= "25" not-null= "true" />
</property>
<property name= "valorItem3" type= "string" >
<column name= "ValorItem3" length= "25" not-null= "true" />
</property>
<property name= "codCliente" type= "int" >
<column name= "CodCliente" not-null= "true" />
</property>
<property name= "codAtendente" type= "short" >
<column name= "CodAtendente" not-null= "true" />
</property>
<property name= "data" type= "date" >
<column name= "Data" length= "10" not-null= "true" />
</property>
<property name= "hora" type= "time" >
<column name= "Hora" length= "8" not-null= "true" />
</property>
<property name= "horaConc" type= "time" >
<column name= "horaConc" length= "8" not-null= "true" />
</property>
<property name= "motivo" type= "char" >
<column name= "Motivo" length= "1" not-null= "true" />
</property>
<property name= "idFaturamento" type= "int" >
<column name= "Id_Faturamento" not-null= "true" />
</property>
<property name= "excluido" type= "char" >
<column name= "Excluido" length= "1" not-null= "true" />
</property>
<property name= "usuarioExcluido" type= "string" >
<column name= "Usuario_Excluido" length= "50" not-null= "true" />
</property>
<property name= "ocultar" type= "char" >
<column name= "ocultar" length= "1" not-null= "true" />
</property>
</class>
</hibernate-mapping>
romarcio 25 de ago. de 2010
Pode fazer assim:
& lt ; property name = "tipoConsulta" type = "string" & gt ;
& lt ; column name = "TipoConsulta" length = "2" not - null = "true" sql - type = "CHAR" /& gt ;
& lt ; / property & gt ;
Vc tem certeza que quando o objeto é salvo, atributo tipoConsulta está com valor?
Se ele estiver null, dai o hibernate não vai deixar salvar.
dymitrios 25 de ago. de 2010
Muito Obrigado Romarcio!!!
Agora deu certo…
Agradeço sua paciência… pois minhas questões podem ter sido muito simples…
Vlw…
romarcio 25 de ago. de 2010
Blz, sem problemas.
Agora faz o seguinte, aqui no forum quando o problema é resolvido deve-se fazer o seguinte.
Vai no primeito post, onde vc colocou sua dúvia. Clica em EDITAR, e quando abrir o editor, ao lado do titulo do post vc escreve [RESOLVIDO]