IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JPA Java Discussion :

JPA - 1er formulaire


Sujet :

JPA Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Inscrit en
    Juillet 2007
    Messages
    75
    Détails du profil
    Informations forums :
    Inscription : Juillet 2007
    Messages : 75
    Par défaut JPA - 1er formulaire
    Bonjour,

    je suis tombé dans le bain de JPA et j'essaie de faire un formulaire pour ajouter des personnes des données dans la table "Personne".

    j'ai ma page index.xhml suivante:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core"
        xmlns:p="http://primefaces.org/ui">                
        <h:head>
            <title><ui:insert name="title">Default Title</ui:insert></title>
            <h:outputStylesheet library="css" name="pfcrud.css"/>
            <h:outputScript library="scripts" name="pfcrud.js"/>
        </h:head>
     
        <body>             
            <p:growl id="growl" widgetVar="my_test" life="1000"/>            
            <!--            <p:layout fullPage="true"  >    -->            
                <h:form id="FormularioForm">
     
                <h:panelGroup id="display">
                    <p:panelGrid columns="2" >
     
                        <p:outputLabel value="#{bundle.CreateVotanteLabel_nombreReconoce}" for="nombreReconoce"  />
                        <p:inputText id="nombreReconoce" value="#{personaController.selected.persona}" title="#{bundle.CreatePersonaTitle_persona}" required="true" requiredMessage="#{bundle.CreatePersonaRequiredMessage_persona}"/>
     
                        <p:outputLabel value="#{bundle.CreateVotanteLabel_nombre}" for="nombre" />
                        <p:inputText id="nombre" value="#{personaController.selected.persona}" title="#{bundle.CreatePersonaTitle_persona}" required="false" requiredMessage="#{bundle.CreatePersonaRequiredMessage_persona}"/>
     
                        <p:outputLabel value="#{bundle.CreateVotanteLabel_appellido}" for="appellido" />
                        <p:inputText id="appellido" value="#{personaController.selected.persona}" title="#{bundle.CreatePersonaTitle_persona}" required="false" requiredMessage="#{bundle.CreatePersonaRequiredMessage_persona}"/>
     
                        <p:outputLabel value="#{bundle.CreateVotanteLabel_documentoIdentidad}" for="documentoIdentidad" />                                                
                        <p:selectOneMenu id="documentoIdentidad" value="#tipoIdentificacionController.selected}" >
     
                            <f:selectItems value="#{tipoIdentificacionController.items}"
                                           var="tipoIdentificacionItem"
                                           itemValue="#{tipoIdentificacionItem}"
                                           itemLabel="#{tipoIdentificacionItem.descripcionCorta.toString()}"
                                           />
    <!--                        <f:converter binding="#{tipoIdentificacionConverter}"/>-->
     
                        </p:selectOneMenu>            
     
                        <p:outputLabel value="#{bundle.CreateVotanteLabel_documentoIdentidadNumero}" for="documentoIdentidadNumero" />
                        <p:inputText id="documentoIdentidadNumero" value="#{personaController.selected.persona}" title="#{bundle.CreatePersonaTitle_persona}" required="true" requiredMessage="#{bundle.CreatePersonaRequiredMessage_persona}"/>
     
                        <p:outputLabel value="#{bundle.CreateVotanteLabel_sectorSocial}" for="lgbti" />
     
                        <p:selectOneMenu id="lgbti" value="#lgbtiController.selected}" >
                            <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                            <f:selectItems value="#{lgbtiController.items}"
                                           var="lgbtiItem"
                                           itemValue="#{lgbtiItem}"
                                           itemLabel="#{lgbtiItem.descripcion.toString()}"
                                           />
                            <f:converter binding="#{lgbtiConverter}"/>
     
                        </p:selectOneMenu>                                      
     
                        <p:outputLabel value="#{bundle.CreateVotanteLabel_correoElectronico}" for="correoElectronico" />
                        <p:inputText id="correoElectronico" value="#{personaController.selected.persona}" title="#{bundle.CreatePersonaTitle_persona}" required="true" requiredMessage="#{bundle.CreatePersonaRequiredMessage_persona}"/>
     
                        <p:outputLabel value="#{bundle.CreateVotanteLabel_fechaNacimiento}" for="fechaNacimiento" />
                        <p:inputText id="fechaNacimiento" value="#{personaController.selected.persona}" title="#{bundle.CreatePersonaTitle_persona}" required="true" requiredMessage="#{bundle.CreatePersonaRequiredMessage_persona}"/>
     
                        <p:outputLabel value="#{bundle.CreateVotanteLabel_localidad}" for="localidad" />
                        <p:inputText id="localidad" value="#{personaController.selected.persona}" title="#{bundle.CreatePersonaTitle_persona}" required="true" requiredMessage="#{bundle.CreatePersonaRequiredMessage_persona}"/>
     
                        <p:outputLabel value="#{bundle.CreateVotanteLabel_telephono}" for="telefono" />
                        <p:inputText id="telefono" value="#{personaController.selected.persona}" title="#{bundle.CreatePersonaTitle_persona}" required="false" requiredMessage="#{bundle.CreatePersonaRequiredMessage_persona}"/>
     
                        <center>
                            <p:outputLabel value="#{bundle.CreateVotanteLabel_contacto}" />
                        </center>
     
                    </p:panelGrid>
     
                    <p:commandButton id="createButton" icon="ui-icon-plus"   value="#{bundle.Create}" action="#{personaController.prepareCreate2}"/>                                  
                    <p:commandButton value="#{bundle.Cancel}" />
     
     
                </h:panelGroup>
     
            </h:form>
            <!--            </p:layout>-->
        </body>                
    </html>
    Ensuite, j'ai une méthode "prepareCreate2" qui va créer une nouvelle instance de Personne et de sauver en BD via la persistence et la méthode "saveNew".

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    public T prepareCreate2(ActionEvent event) {
            T newItem;
            try {
                newItem = itemClass.newInstance();
                this.selected = newItem;
                initializeEmbeddableKey();
     
                String msg = ResourceBundle.getBundle("/Bundle").getString(itemClass.getSimpleName() + "Created");
                persist(AbstractController.PersistAction.CREATE, msg);
                if (!isValidationFailed()) 
                {
                    items = null; // Invalidate list of items to trigger re-query.
                }
                saveNew(event);
     
                return newItem;
            } catch (InstantiationException ex) {
                Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex);
            } catch (IllegalAccessException ex) {
                Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex);
            }
            return null;
        }
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    public void saveNew(ActionEvent event) {
            String msg = ResourceBundle.getBundle("/Bundle").getString(itemClass.getSimpleName() + "Created");
            persist(AbstractController.PersistAction.CREATE, msg);
            if (!isValidationFailed()) {
                items = null; // Invalidate list of items to trigger re-query.
            }
        }
    Le problème est que lorsque j'appuie sur le bouton "Create", j'obtiens l'erreur suivante:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    javax.el.PropertyNotFoundException: /Proyectos/Formulario/index.xhtml @23,227 value="#{personaController.selected.persona}": Target Unreachable, 'null' returned null
    	at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:100)
    	at org.primefaces.util.ComponentUtils.getConverter(ComponentUtils.java:124)
    	at org.primefaces.renderkit.InputRenderer.getConvertedValue(InputRenderer.java:183)
    	at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1046)
    	at javax.faces.component.UIInput.validate(UIInput.java:976)
    	at javax.faces.component.UIInput.executeValidate(UIInput.java:1249)
    	at javax.faces.component.UIInput.processValidators(UIInput.java:712)
    	at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
    	at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
    	at javax.faces.component.UIForm.processValidators(UIForm.java:253)
    	at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
    	at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1195)
    	at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
    	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
    	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
    	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
    	at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
    	at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
    	at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
    	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
    	at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
    	at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
    	at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
    	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
    	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
    	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
    	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
    	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
    	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
    	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
    	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
    	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
    	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
    	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
    	at java.lang.Thread.run(Thread.java:722)
    Caused by: javax.el.PropertyNotFoundException: Target Unreachable, 'null' returned null
    	at com.sun.el.parser.AstValue.getTarget(AstValue.java:192)
    	at com.sun.el.parser.AstValue.getType(AstValue.java:86)
    	at com.sun.el.ValueExpressionImpl.getType(ValueExpressionImpl.java:201)
    	at org.jboss.weld.el.WeldValueExpression.getType(WeldValueExpression.java:93)
    	at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:98)
    je comprends bien que l'instance Personne est nulle mais comment je fais si je veux l'instancier dans ma méthode "prepareCreate2" ???

    Toutes les suggestions sont les bienvenues

  2. #2
    Membre Expert Avatar de jeffray03
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2008
    Messages
    1 501
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Allemagne

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 501
    Par défaut
    peux-tu nous montrer comment est ce que tu as defini ta classe: PersonaController

    Merci

  3. #3
    Membre confirmé
    Inscrit en
    Juillet 2007
    Messages
    75
    Détails du profil
    Informations forums :
    Inscription : Juillet 2007
    Messages : 75
    Par défaut
    voila la classe personaController

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    @ManagedBean(name = "personaController")
    @SessionScoped
    public class PersonaController extends AbstractController<Persona> implements Serializable {
     
        @EJB
        private PersonaFacade ejbFacade;
     
        public PersonaController() {
            super(Persona.class);
        }
     
        @PostConstruct
        public void init() {
            super.setFacade(ejbFacade);
        }
    et la classe "maître" AbstractController

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    public abstract class AbstractController<T> {
     
        private AbstractFacade<T> ejbFacade;
        private Class<T> itemClass;
        private T selected;
        private List<T> items;
     
        private enum PersistAction {
     
            CREATE,
            DELETE,
            UPDATE
        }
     
        public AbstractController() {
        }
     
        public AbstractController(Class<T> itemClass) {
            this.itemClass = itemClass;
        }
     
        protected AbstractFacade<T> getFacade() {
            return ejbFacade;
        }
     
        protected void setFacade(AbstractFacade<T> ejbFacade) {
            this.ejbFacade = ejbFacade;
        }
     
        public T getSelected() 
        {
            if (selected == null)
            {
                try{
                T newItem;
                newItem = itemClass.newInstance();
                selected = newItem;
                }
                catch (InstantiationException ex) 
                {
                     Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex);
                } catch (IllegalAccessException ex) 
                {
                    Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex);
                }            
            }           
            return selected;
        }
     
        public void setSelected(T selected) {
            this.selected = selected;
        }
     
        protected void setEmbeddableKeys() {
            // Nothing to do if entity does not have any embeddable key.
        }
     
        ;
     
        protected void initializeEmbeddableKey() {
            // Nothing to do if entity does not have any embeddable key.
        }
     
        /**
         * Returns all items in a List object
         *
         * @return
         */
        public List<T> getItems() {
            if (items == null) {
                items = this.ejbFacade.findAll();
            }
            return items;
        }
     
        public void setItems(List<T> items) {
            this.items = items;
        }
     
        public void save(ActionEvent event) {
            String msg = ResourceBundle.getBundle("/Bundle").getString(itemClass.getSimpleName() + "Updated");
            persist(AbstractController.PersistAction.UPDATE, msg);
        }
     
        public void saveNew(ActionEvent event) {
            String msg = ResourceBundle.getBundle("/Bundle").getString(itemClass.getSimpleName() + "Created");
            persist(AbstractController.PersistAction.CREATE, msg);
            if (!isValidationFailed()) {
                items = null; // Invalidate list of items to trigger re-query.
            }
        }
     
        public void delete(ActionEvent event) {
            String msg = ResourceBundle.getBundle("/Bundle").getString(itemClass.getSimpleName() + "Deleted");
            persist(AbstractController.PersistAction.DELETE, msg);
            if (!isValidationFailed()) {
                selected = null; // Remove selection
                items = null; // Invalidate list of items to trigger re-query.
            }
        }
     
        private void persist(AbstractController.PersistAction persistAction, String successMessage) {
            if (selected != null) {
                this.setEmbeddableKeys();
                try {
                    if (persistAction != AbstractController.PersistAction.DELETE) {
                        this.ejbFacade.edit(selected);
                    } else {
                        this.ejbFacade.remove(selected);
                    }
                    JsfUtil.addSuccessMessage(successMessage);
                } catch (EJBException ex) {
                    String msg = "";
                    Throwable cause = JsfUtil.getRootCause(ex.getCause());
                    if (cause != null) {
                        msg = cause.getLocalizedMessage();
                    }
                    if (msg.length() > 0) {
                        JsfUtil.addErrorMessage(msg);
                    } else {
                        JsfUtil.addErrorMessage(ex, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured"));
                    }
                } catch (Exception ex) {
                    Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex);
                    JsfUtil.addErrorMessage(ex, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured"));
                }
            }
        }
     
        /**
         * Creates a new instance of an underlying entity and assigns it to Selected
         * property.
         *
         * @return
         */
        public T prepareCreate(ActionEvent event) {
            T newItem;
            try {
                newItem = itemClass.newInstance();
                this.selected = newItem;
                initializeEmbeddableKey();
                return newItem;
            } catch (InstantiationException ex) {
                Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex);
            } catch (IllegalAccessException ex) {
                Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex);
            }
            return null;
        }
     
        public T prepareCreate2(ActionEvent event) {
    //        T newItem;
    //        try {                        
    //            newItem = itemClass.newInstance();
    //            this.selected = newItem;
                initializeEmbeddableKey();
     
                String msg = ResourceBundle.getBundle("/Bundle").getString(itemClass.getSimpleName() + "Created");
                persist(AbstractController.PersistAction.CREATE, msg);
                if (!isValidationFailed()) 
                {
                    items = null; // Invalidate list of items to trigger re-query.
                }
                saveNew(event);
     
                return selected;
    //        } catch (InstantiationException ex) {
    //            Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex);
    //        } catch (IllegalAccessException ex) {
    //            Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex);
    //        }
    //        return null;
        }
     
        public boolean isValidationFailed() {
            return JsfUtil.isValidationFailed();
        }
    et la "facade" pour personne

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    @Stateless
    public class PersonaFacade extends AbstractFacade<Persona> {
        @PersistenceContext(unitName = "ProyectosPU")
        private EntityManager em;
        private PersonaFacade ejbFacade;
        private DependenciaFuncionarioController dependenciaFuncionarioController;
       // @Inject
       // private transient Logger logger;
        private String login = null;
        private String password = null;
        private Persona persona = new Persona();
        private List<Persona> listaPersona;
        private List<DependenciaFuncionario> listaDependenciaFuncionario;
        private List<Menu> listaMenuPersona;
        private DependenciaFuncionario dependenciaFuncionario;
        private DependenciaFuncionario GmDependenciaFuncionario;
        private List<Menu> GmListaMenuPersona;
        private List<Menu> GmListaMenu;
        private List<Menu> listaMenu;  
     
        @Override
        protected EntityManager getEntityManager() {
            return em;
        }
     
        public PersonaFacade() {
            super(Persona.class);
        }
     
        public List<Menu> listaMenuPersona(Persona persona) {
            listaMenuPersona =  new  ArrayList<Menu>();
            Query query = em.createQuery("SELECT m FROM Menu m WHERE exists (SELECT mr.menu FROM MenuRol mr, PersonaRol pr WHERE mr.menu = m AND mr.rol = pr.rol AND pr.persona = :parametroPersona) ");
            query.setParameter("parametroPersona", persona); 
            listaMenuPersona = query.getResultList(); 
            return listaMenuPersona;
        }    
     
        public List<Menu> listaMenu() {
            listaMenu =  new  ArrayList<Menu>();
            Query query = em.createQuery("SELECT m FROM Menu m ");
            listaMenu = query.getResultList(); 
            return listaMenu;
        }    
     
        public DependenciaFuncionario dependenciaFuncionario(Persona persona) {
            DependenciaFuncionario dependenciaFuncionario;
            Query query = em.createQuery("SELECT df FROM DependenciaFuncionario df WHERE df.fechaSalida IS NULL AND df.persona = :parametroPersona ");
            query.setParameter("parametroPersona", persona); 
            dependenciaFuncionario = (DependenciaFuncionario)query.getSingleResult(); 
            return dependenciaFuncionario;
        }    
     
        public List<Menu> getListaMenu() {
            return listaMenu;
        }
     
        public void setListaMenu(List<Menu> listaMenu) {
            this.listaMenu = listaMenu;
        }
     
    }

  4. #4
    Membre Expert Avatar de jeffray03
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2008
    Messages
    1 501
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Allemagne

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 501
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    personaController.selected
    mais selected est du type Persona ou bien?
    alors pourquoi fais-tu :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    personaController.selected.persona
    ?


    essaies de rectifier cela.
    soit tu fais:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    personaController.selected.(propriete de la classe persona)
    Eric

Discussions similaires

  1. [AC-2010] Copier texte 1er formulaire dans le 2ieme
    Par scoobydoos dans le forum VBA Access
    Réponses: 1
    Dernier message: 15/11/2010, 15h10
  2. Réponses: 5
    Dernier message: 16/04/2008, 12h23
  3. Réponses: 6
    Dernier message: 25/03/2008, 15h32
  4. 1er formulaire reload 2eme formulaire
    Par themateo dans le forum Général JavaScript
    Réponses: 3
    Dernier message: 05/11/2007, 16h49
  5. focus sur le 1er champ d'un formulaire
    Par ramone dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 07/03/2007, 16h22

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo