[JBoss-user] [EJB 3.0] - How to make a joint by condition ?
I have an entity witch map with PERSON table @Entity @Table(name = "PERSON") public class PersonEntity implements Serializable { protected static final long serialVersionUID = 1L; protected int numPerson; protected String sex; ... protected Collection childs; @Id( generate = GeneratorType.AUTO) @Column (name = "NUM_PERSON") public int getNumPerson() { return numPerson; } public void setNumPerson(int numPerson) { this.numPerson = numPerson; } @Column (name = "SEX") public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } .. @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="father") @JoinColumn(name="FK_PERSON_FATHER") // Foreign key in PERSON public Collection getChilds() { return childs; } public void setChilds(Collection childs) { this.childs = childs; } } My problem is: I need to load "childs" collection by joint on FK_PERSON_FATHER column if SEX='M' or by joint on FK_PERSON_MOTHER column if SEX='W'. (In the exemple above the joint is done on FK_PERSON_FATHER) Is it possible to do that ? here is the DDL of "PERSON" table CREATE TABLE PERSON ( NUM_PERSON INTEGER AUTO_INCREMENT NOT NULL ,SEX VARCHAR(1) NOT NULL ,FK_PERSON_FATHER INTEGER ,FK_PERSON_MOTHER INTEGER ,PRIMARY KEY (NUM_PERSON) ); INSERT INTOPERSON (NUM_PERSON,SEX) VALUES (1,'racin','racin','racin','racin','M'); ALTER TABLE PERSON ADD ( FOREIGN KEY (FK_PERSON_FATHER) REFERENCES PERSON(NUM_PERSON) ,FOREIGN KEY (FK_PERSON_MOTHER) REFERENCES PERSON(NUM_PERSON) ); View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3925348#3925348 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3925348 --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [EJB 3.0] - Problem when executing query
I have this EJB Session : @Stateless @Remote(Paulva.class) public class PaulvaBean implements Paulva { /** * Gestionaire de persistence */ @PersistenceContext(unitName="paulva") protected EntityManager entityManager; public boolean authenticate(String pseudo, String password) { if (log.isDebugEnabled()) { log.debug("START " + getClass() + ".authenticate"); } boolean isValid= false; if (check(pseudo,MIN_PSEUDO_SIZE,MAX_PSEUDO_SIZE) && check(password,MIN_PASSWORD_SIZE,MAX_PASSWORD_SIZE)) { if (log.isDebugEnabled()) { log.debug("pseudo="+pseudo+" checked."); } // définition de la requête Query query=entityManager.createQuery("SELECT a FROM Ancien a WHERE a.pseudo = :pseudo AND a.password = :password"); // Substitution des paramètres de la requête query.setParameter("pseudo",pseudo); query.setParameter("password",password); // Exécution de la requete AncienEntity ancien=(AncienEntity)query.getSingleResult(); isValid=ancien!=null; } if (log.isDebugEnabled()) { log.debug("END " + getClass() + ".authenticate"); } return isValid; } private boolean check(String value,int min,int max) { return (value!=null)&&(value.length()>=min)&&(value.length()<=max); } . } but when I execute the query bellow ... AncienEntity ancien=(AncienEntity)query.getSingleResult(); ... I have this error in log: 2006-01-08 18:17:45,326 INFO security.JaccHelper - Initialising JACC Context for deployment: paulva-bus.jar 2006-01-08 18:17:45,405 INFO ejb3.Ejb3AnnotationHandler - found EJB3: ejbName=com.paulva.business.PaulvaBean, class=com.paulva.business.PaulvaBean, type=STATELESS 2006-01-08 18:17:45,748 INFO security.JaccHelper - com.paulva.business.PaulvaBean has no @SecurityDomain - skipping JACC configuration 2006-01-08 18:17:45,826 INFO ejb3.Ejb3Deployment - Found persistence.xml file in EJB3 jar 2006-01-08 18:17:46,530 INFO ejb3.Ejb3Deployment - Create EntityManager with JNDI name: paulva 2006-01-08 18:17:46,530 INFO security.JaccHelper - JACC Policy Configuration for deployment has been put in service 2006-01-08 18:17:46,530 INFO ejb3.Ejb3Deployment - EJB3 deployment time took: 1204 2006-01-08 18:17:46,951 INFO ejb3.ProxyDeployer - no declared remote bindings for : com.paulva.business.PaulvaBean 2006-01-08 18:17:46,951 INFO ejb3.ProxyDeployer - there is remote interfaces for com.paulva.business.PaulvaBean 2006-01-08 18:17:46,951 INFO ejb3.ProxyDeployer - default remote binding has jndiName of com.paulva.business.Paulva 2006-01-08 18:17:47,108 INFO ejb3.EJB3Deployer - Deployed: file:/C:/java/jboss-4.0.3SP1/server/all/deploy/paulva-bus.jar 2006-01-08 18:18:11,280 DEBUG business.PaulvaBean - START class com.paulva.business.PaulvaBean.authenticate 2006-01-08 18:18:11,280 DEBUG business.PaulvaBean - END class com.paulva.business.PaulvaBean.authenticate 2006-01-08 18:18:11,358 DEBUG business.PaulvaBean - START class com.paulva.business.PaulvaBean.authenticate 2006-01-08 18:18:11,358 DEBUG business.PaulvaBean - pseudo=PSEUDO0 checked. 2006-01-08 18:18:11,842 ERROR socket.ServerThread - failed java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:168) at java.io.BufferedInputStream.fill(BufferedInputStream.java:218) at java.io.BufferedInputStream.read(BufferedInputStream.java:235) at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2200) at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2380) at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2447) at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2519) at java.io.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputStream.java:2668) at java.io.ObjectInputStream.readByte(ObjectInputStream.java:864) at org.jboss.remoting.transport.socket.ServerSocketWrapper.checkConnection(ServerSocketWrapper.java:54) at org.jboss.remoting.transport.socket.ServerThread.acknowledge(ServerThread.java:217) at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:298) at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:169) View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3916340#3916340 Reply to the post :
[JBoss-user] [Installation, Configuration & Deployment] - Could not create deployment: file:.../jboss-4.0.3RC2/server/
I try to start JBoss Server in Eclipse, but I have this error in console: 23:05:52,812 ERROR [MainDeployer] Could not create deployment: file:/C:/java/jboss-4.0.3RC2/server/default/deploy/ejb3.deployer/ org.jboss.deployment.DeploymentException: Unexpected error during load of: org.jboss.ejb3.EJB3Deployer, msg=org/jboss/ejb3/EJB3Deployer (Unsupported major.minor version 49.0); - nested throwable: (java.lang.ClassNotFoundException: Unexpected error during load of: org.jboss.ejb3.EJB3Deployer, msg=org/jboss/ejb3/EJB3Deployer (Unsupported major.minor version 49.0)) at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:178) at org.jboss.system.ServiceController.install(ServiceController.java:216) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80) at org.jboss.mx.server.Invocation.invoke(Invocation.java:72) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644) at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176) at $Proxy4.install(Unknown Source) at org.jboss.deployment.SARDeployer.create(SARDeployer.java:223) at org.jboss.deployment.MainDeployer.create(MainDeployer.java:919) at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:773) at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:737) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80) at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118) at org.jboss.mx.server.Invocation.invoke(Invocation.java:74) at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127) at org.jboss.mx.server.Invocation.invoke(Invocation.java:74) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644) at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176) at $Proxy6.deploy(Unknown Source) at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:319) at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:507) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:192) at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:265) at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:287) at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:236) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80) at org.jboss.mx.server.Invocation.invoke(Invocation.java:72) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644) at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:974) at $Proxy0.start(Unknown Source) at org.jboss.system.ServiceController.start(ServiceController.java:453) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
[JBoss-user] [Beginners Corner] - How to add a directory in CLASSPATH of JBoss test server in
How to add a directory in CLASSPATH of JBoss test server in Eclipse 3 ? I need to add a directory in CLASSPATH of JBoss test server. How can I do that ? View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3876266#3876266 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3876266 --- This SF.Net email is sponsored by: NEC IT Guy Games. Get your fingers limbered up and give it your best shot. 4 great events, 4 opportunities to win big! Highest score wins.NEC IT Guy Games. Play to win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user