Erro hibernate

11 respostas
F

vejam o erro… parece que ta quase funcionando…hehe

org.hibernate.MappingException: component class not found: TbModalidadeId
	at org.hibernate.mapping.Component.getComponentClass(Component.java:101)
	at org.hibernate.tuple.PojoComponentTuplizer.buildGetter(PojoComponentTuplizer.java:105)
	at org.hibernate.tuple.AbstractComponentTuplizer.<init>(AbstractComponentTuplizer.java:40)

agora o xml…

<hibernate-mapping>
    <class name="TbModalidade" table="TB_MODALIDADE">
        <composite-id name="id" class="TbModalidadeId">
            <key-property name="grmCodigo" type="string">
                <column name="GRM_CODIGO" length="2" />
            </key-property>
            <key-property name="mopCodigo" type="string">
                <column name="MOP_CODIGO" length="7" />
            </key-property>
            <key-property name="modCodigo" type="string">
                <column name="MOD_CODIGO" length="4" />
            </key-property>
        </composite-id>
        <many-to-one name="tbAgencia" class="TbAgencia" fetch="select">
            <column name="AGE_ID" precision="10" scale="0" />
        </many-to-one>
        <property name="modNome" type="string">
            <column name="MOD_NOME" length="65" not-null="true" />
        </property>
        <property name="modSigla" type="string">
            <column name="MOD_SIGLA" length="7" />
        </property>
        <property name="modDtCarga" type="date">
            <column name="MOD_DT_CARGA" length="7" />
        </property>
        <property name="modAtuStat" type="string">
            <column name="MOD_ATU_STAT" length="1" />
        </property>
        <property name="modDtRef" type="date">
            <column name="MOD_DT_REF" length="7" />
        </property>
        <property name="modDuracao" type="string">
            <column name="MOD_DURACAO" length="15" />
        </property>
        <set name="dwFomentos" inverse="true">
            <key>
                <column name="GRM_CODIGO" length="2" />
                <column name="MOP_CODIGO" length="7" />
                <column name="MOD_CODIGO" length="4" />
            </key>
            <one-to-many class="DwFomento" />
        </set>
    </class>
</hibernate-mapping>

o eclipse gerou o xml automatico. sera que nao fez nada errado?
brigadao ai…

11 Respostas

M

Você esta indicando que seu mapeamento é com uma Composite ID chamada TbModalidadeId, e o erro indica que você não fez esta classe ou não indicou adequadamento o caminho que ela se encontra.

F

cara, a classe ta la, na verdade eu coloquei os xmls na mesma pasta dos . java pra evitar qualquer problema…
eles estao na pasta hibernate…
rola de vc me dar um exemplozinho ai…
tipo assim

se existisse uma pasta hibernate como ficaria isso?

ramilani12

vc indicou no hibernate.cfg.xml o mapping resource esse XML?

F

olha ele todo ai… essa @#$% ta quase funcionando. ja to puto aqui. valeu…

<?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.bytecode.use_reflection_optimizer">
			false
		</property>
		<property name="hibernate.connection.driver_class">
			oracle.jdbc.driver.OracleDriver
		</property>
		<property name="hibernate.connection.password">
			ibict_fs
		</property>
		<property name="hibernate.connection.url">
			jdbc:oracle:thin:@192.168.0.254:1521:sigmab
		</property>
		<property name="hibernate.connection.username">
			ibict_fs
		</property>
		<property name="hibernate.default_schema">IBICT_FS</property>
		<property name="hibernate.dialect">
			org.hibernate.dialect.OracleDialect
		</property>

		<mapping resource="hibernate/TbModalidade.hbm.xml" />
		<mapping resource="hibernate/TbInstituicao.hbm.xml" />
		<mapping resource="hibernate/TbSetorProdutivo.hbm.xml" />
		<mapping resource="hibernate/VwCorteAssunto.hbm.xml" />
		<mapping resource="hibernate/VwArea.hbm.xml" />
		<mapping resource="hibernate/TbInstDel.hbm.xml" />
		<mapping resource="hibernate/DwFomentoFundos.hbm.xml" />
		<mapping resource="hibernate/FomentoVigente.hbm.xml" />
		<mapping resource="hibernate/TbAgencia.hbm.xml" />
		<mapping resource="hibernate/StopWord.hbm.xml" />
		<mapping resource="hibernate/TbInstAud.hbm.xml" />
		<mapping resource="hibernate/Auditoria1.hbm.xml" />
		<mapping resource="hibernate/Cargas.hbm.xml" />
		<mapping resource="hibernate/TbEveTipo.hbm.xml" />
		<mapping resource="hibernate/TbEndereco.hbm.xml" />
		<mapping resource="hibernate/TbInsCategoriaOrgao.hbm.xml" />
		<mapping resource="hibernate/BolsaAtiva.hbm.xml" />
		<mapping resource="hibernate/TbInstOrigem.hbm.xml" />
		<mapping resource="hibernate/TbAnaliseCargaA.hbm.xml" />
		<mapping resource="hibernate/TbEventoAudBk.hbm.xml" />
		<mapping resource="hibernate/TbEventoPalavraChave.hbm.xml" />
		<mapping resource="hibernate/TbAnaliseCarga.hbm.xml" />
		<mapping resource="hibernate/TbAplicativo.hbm.xml" />
		<mapping resource="hibernate/DwFundos.hbm.xml" />
		<mapping resource="hibernate/TbCidade.hbm.xml" />
		<mapping resource="hibernate/TbInstMantenedora.hbm.xml" />
		<mapping resource="hibernate/DwPesquisadorRedir.hbm.xml" />
		<mapping resource="hibernate/TbEventos.hbm.xml" />
		<mapping resource="hibernate/TbAnaliseCargaB.hbm.xml" />
		<mapping resource="hibernate/DwFomento.hbm.xml" />
		<mapping resource="hibernate/TbInstTemp.hbm.xml" />
		<mapping resource="hibernate/TbPais.hbm.xml" />
		<mapping resource="hibernate/Servico.hbm.xml" />
		<mapping resource="hibernate/DwFomentoValor.hbm.xml" />
		<mapping resource="hibernate/ErroCargas.hbm.xml" />
		<mapping resource="hibernate/DwFundoEditais.hbm.xml" />
		<mapping resource="hibernate/TbAtivTecnica.hbm.xml" />
		<mapping resource="hibernate/TbPesquisador.hbm.xml" />
		<mapping resource="hibernate/TbInstEndereco.hbm.xml" />
		<mapping resource="hibernate/TbAplicativoAgencia.hbm.xml" />
		<mapping resource="hibernate/TbEventoAud.hbm.xml" />
		<mapping resource="hibernate/TbAnaliseCargaF.hbm.xml" />
		<mapping resource="hibernate/TbAreaConhecimento.hbm.xml" />
		<mapping resource="hibernate/TbEveParceiros.hbm.xml" />
		<mapping resource="hibernate/UsuarioBolsista.hbm.xml" />
		<mapping resource="hibernate/TbUf.hbm.xml" />
		<mapping resource="hibernate/HistoricoAtas.hbm.xml" />
		<mapping resource="hibernate/TbEventoContato.hbm.xml" />
		<mapping resource="hibernate/TbEveContato.hbm.xml" />
		<mapping resource="hibernate/TbGrupoModalidade.hbm.xml" />
		<mapping resource="hibernate/DwPesquisador.hbm.xml" />
		<mapping resource="hibernate/VwAbf.hbm.xml" />
		<mapping resource="hibernate/DwFomentoPalavraChave.hbm.xml" />
		<mapping resource="hibernate/TbEventosOriginal.hbm.xml" />
		<mapping resource="hibernate/TbModalidadePadrao.hbm.xml" />
	</session-factory>
</hibernate-configuration>
M

Um Exemplo do próprio Hibernate

ramilani12

veja o erro:

rg.hibernate.MappingException: component class not found: TbModalidadeId

seu XML:

&lt;hibernate-mapping&gt;
     &lt;class name="TbModalidadeId" table="TB_MODALIDADE"&gt; //o certo nao seria TbModalidadeId ?

Estou apredendo hibernate agora …

F

acho que nao. o TB_MODALIDADE é a tabela no banco. essa @#$% dessa classe tdModalidadeId.java o eclipse criou sozinho… nem sei pra que serve essa porcaria…tb to aprendendo agora … mas ja ajudou muito. valeu.

ramilani12

Sim , mas seu xxx.hbm.xml
na tag:

<class name="TbModalidadeId" table="TB_MODALIDADE">

o class name=deve ser o mesmo nome da sua classe Pojo , por isso ele gera a exception que nao encontra a classe

keller
org.hibernate.MappingException: component class not found: TbModalidadeId

Ele nao esta encontrando a sua classe TbModalidadeId.
Verifique se com os HBMs estao os .CLASS

Package voce esta usando?
( Pelo que eu me lembro no outro topico voce disse que nao )

Valeu? Até… :thumbup:

F

pois eh. consegui aqui. agora o erro mudou…hehe

2006-07-19 10:48:22,109 INFO  hibernate.cfg.Configuration  -> processing extends queue
2006-07-19 10:48:22,109 INFO  hibernate.cfg.Configuration  -> processing collection mappings
org.hibernate.MappingException: Association references unmapped class: hibernate.DwFomento
	at org.hibernate.cfg.HbmBinder.bindCollectionSecondPass(HbmBinder.java:2036)
	at org.hibernate.cfg.HbmBinder$CollectionSecondPass.secondPass(HbmBinder.java:2497)
	at org.hibernate.cfg.HbmBinder$SecondPass.doSecondPass(HbmBinder.java:2468)
	at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:884)

mas obrigado a todos

keller
org.hibernate.MappingException: Association references unmapped class: hibernate.DwFomento

Uma associacao esta se referindo a uma
classe nao mapeada.

*Dica:

Faca uma nova database “java” ,
com uma tabela “Item” ,
com as colunas “id” e “descricao”.

Trabalhe nessa database e essa tabela.
Quando voce conseguir fazer ela funcionar
com o hibernate o 1o passo esta concluido.

Depois faça alguns relacionamentos.
e entao depois tente colocar o hibernate no seu sistema.

Resumindo , consiga aquilo que chamam de know-how.

Valeu? Até… :thumbup:

Criado 19 de julho de 2006
Ultima resposta 19 de jul. de 2006
Respostas 11
Participantes 4