-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: View with relationships
PostPosted: Wed Jun 13, 2007 9:20 am 
Newbie

Joined: Wed Jun 13, 2007 9:06 am
Posts: 1
Location: Brazil
Hello,

I need to create a mapping to View with relationships, but I'dont success to it.

I am using Hibernate 3, my Database is MySql 5.2

My mapping documents:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping
    PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
   
    <hibernate-mapping package="br.com.absoluta.dto">
    <class name="CnsProduto" table="vw_sel_produto">
   
    <id name="id" column="id" >
      <generator class="assigned" />
   </id>
   

   
    <property name="codigo"></property>   
    <property name="codigoDoc"></property>
    <property name="numDocumento"></property>
    <property name="data" column="data" type="java.util.Date"></property>
    <property name="quantidade"></property>
    <property name="sinal"></property>
   
   </class>
    </hibernate-mapping>


My view

Code:
CREATE VIEW VW_SEL_PRODUTO AS
SELECT produto.id ,produto.codigo, produto.descricao, produto.qtdMinima, produto.qtdAtual,
          produto.qtdReservada, produto.valorVenda, requisicao.numDocumento,
          requisicao.data, requisicao.quantidade, documento.codigo as codigodoc, documento.sinal
          FROM produto INNER JOIN requisicao ON requisicao.produto_id = produto.id
          INNER JOIN documento ON requisicao.documento_id = documento.id
          ORDER BY PRODUTO.CODIGO;


I am using framework MVC to manager my session.

The return the View in application is first row duplicate, but I have two rows in my Database different .

Somebody can help me?

Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.