System.out.println ("HELLO PERSONAL"); I am beginning the studies with Hibernate and I am wondering how I do for logar with a supplier that consists a codEmpresa in his/her table as key FK, to the logar and to verify that the code is an altomaticamente he falls in the listing of suppliers, I am with doubt as I recover that and as I do in HBM: <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> <class name = "br.com.sisger.model.bean.Fornecedor" table = "supplier"> <id name = "code"> <generator class = "native"></generator> </ id> <property name = "nome"></property> <property name = "endereco"></property> <property name = "email"></property> <property name = "bairro"></property> <property name = "cidade"></property> <property name = "cep"></property> <property name = "estado"></property> <property name = "fone"></property> <property name = "celular"></property> <property name = "cpf"></property> <property name = "obs"></property> <property name = "rg"></property> <property name = "orgaorg"></property> <property name = "desde"></property> <property name = "cnpj"></property> <property name = "insest"></property> <property name = "fax"></property> <property name = "contato"></property> <property name = "auditoria"></property> <property name = "codEmpresa"></property> <bag name = "products" table = "product" inverse = "true" lazy = "false" fetch = "select" cascade = "all"> <key column = "fornecedor_codigo"></key> <one-to-many class = "br.com.sisger.model.bean.Produto" /> </ bag> </ class> </ hibernate-mapping> </ CODE> See that when listing my suppliers I list my products that each one has, but he/she needed to catch him/it of the section and to list him/it: <property name = "codEmpresa"></property> Only with the code 1 that is it of his/her login, in other words, only to list suppliers with codEmpresa = 1. Hug. excuse me for my English to be very scratched lolololo
|