fnandos 17 de jun. de 2008
tentou?
HibernateUtility . getSession (). createQuery ( Instituicao from FacdbGeral ). list ()
PBNETO 17 de jun. de 2008
mizael86 17 de jun. de 2008
mostra o mapeamento de FacdbGeral
PBNETO 17 de jun. de 2008
Segue o mapeamento (FacdbGeral.hbm.xml):
<?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>
<!--
Auto-generated mapping file from
the hibernate.org cfg2hbm engine
-->
<class name= "br.empresa.facdb.dao.FacdbGeral" table= "FacdbGeral" schema= "dbo" catalog= "smarxrlaser" >
<id name= "IdInstituicao" type= "integer" >
<column name= "IdInstituicao" />
<generator class= "increment" />
</id>
<property name= "Instituicao" type= "string" >
<column name= "Instituicao" length= "50" not-null= "true" />
</property>
<property name= "Separador" type= "string" >
<column name= "Separador" length= "1" not-null= "true" />
</property>
<property name= "Numero_Lote_Inicial" type= "integer" >
<column name= "Numero_Lote_Inicial" not-null= "true" />
</property>
<property name= "Numero_Lote_Final" type= "integer" >
<column name= "Numero_Lote_Final" not-null= "true" />
</property>
<property name= "Fac_Local" type= "integer" >
<column name= "Fac_Local" not-null= "true" />
</property>
<property name= "Fac_Estadual" type= "integer" >
<column name= "Fac_Estadual" not-null= "true" />
</property>
<property name= "Fac_Nacional" type= "integer" >
<column name= "Fac_Nacional" not-null= "true" />
</property>
<property name= "Cabecalho_Midia" type= "integer" >
<column name= "Cabecalho_Midia" not-null= "true" />
</property>
<property name= "Detalhe_Midia" type= "integer" >
<column name= "Detalhe_Midia" not-null= "true" />
</property>
<property name= "Rodape_Midia" type= "integer" >
<column name= "Rodape_Midia" not-null= "true" />
</property>
<property name= "Nome_Arq_Midia" type= "string" >
<column name= "Nome_Arq_Midia" length= "200" not-null= "true" />
</property>
<property name= "DrPostagem" type= "integer" >
<column name= "DrPostagem" not-null= "true" />
</property>
<property name= "CodAdmin" type= "string" >
<column name= "CodAdmin" length= "20" not-null= "true" />
</property>
<property name= "NrCartaoPostagem" type= "string" >
<column name= "NrCartaoPostagem" length= "20" not-null= "true" />
</property>
<property name= "CodUnidPostagem" type= "string" >
<column name= "CodUnidPostagem" length= "20" not-null= "true" />
</property>
<property name= "CepUnidPostagem" type= "string" >
<column name= "CepUnidPostagem" length= "20" not-null= "true" />
</property>
<property name= "NroContrato" type= "string" >
<column name= "NroContrato" length= "20" not-null= "true" />
</property>
</class>
</hibernate-mapping>
E o da conexão (hibernate.cfg.xml):
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name= "hibernate.cglib.use_reflection_optimizer" > true</property>
<property name= "hibernate.connection.driver_class" > com.microsoft.jdbc.sqlserver.SQLServerDriver</property>
<property name= "hibernate.connection.password" > xxxxxxxxx</property>
<property name= "hibernate.connection.url" > jdbc:microsoft:sqlserver://terra\\mar:1600;DatabaseName=smarxrlaser;SelectMethod=cursor</property>
<property name= "hibernate.connection.username" > facdb</property>
<property name= "hibernate.dialect" > org.hibernate.dialect.SQLServerDialect</property>
<!-- Condiguracao do c3p0
<property name="hibernate.c3p0.max_size">10</property>
<property name="hibernate.c3p0.min_size">2</property>
<property name="hibernate.c3p0.timeout">5000</property>
<property name="hibernate.c3p0.max_statements">10</property>
<property name="hibernate.c3p0.idle_test_period">3000</property>
<property name="hibernate.c3p0.acquire_increment">2</property>
-->
<!-- Configuracao de debug
<property name="show_sql">false</property>
<property name="use_outer_join">true</property>
<property name="hibernate.generate_statistics">false</property>
<property name="hibernate.use_sql_comments">false</property>
-->
<mapping resource= "Facdb.hbm.xml" />
</session-factory>
</hibernate-configuration>
PBNETO 17 de jun. de 2008
mizael86, identifiquei o problema!
Foi uma mancada minha…
Ali no final da conexão eu não havia mapeado o “FacdbGeral.hbm.xml” corretamente…
Deu certo trocando:
<mapping resource="Facdb.hbm.xml" />
Por:
<mapping resource="FacdbGeral.hbm.xml" />
Muito obrigado pela ajuda!
mizael86 17 de jun. de 2008
Isso que eu ia falar agora ehhehe, mais blz, parabens