[JBoss-user] [EJB 3.0] - Re: ManyToMany biderectional
Any more ideas ? thanks View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3931874#3931874 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3931874 --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [EJB 3.0] - Re: ManyToMany biderectional
Thanks Peter for your reply. I agree there is a potential problem there by the relationship between stock and Produit is a One to One, so there are no collections there, but I have fixed the code . I am still getting the same exception with and if I set the fetch type to EAGER I get the following : | java.lang.reflect.UndeclaredThrowableException | at $Proxy0.selectAll(Unknown Source) | at com.elina.commercialis.client.delegate.stock.produit.ProduitDelegate.findAllProduits(ProduitDelegate.java:36) | at com.elina.commercialis.client.gui.model.stock.produit.ProduitTreeModel.initModel(ProduitTreeModel.java:38) | at com.elina.commercialis.client.gui.model.stock.produit.ProduitTreeModel.(ProduitTreeModel.java:29) | at com.elina.commercialis.client.gui.screens.stock.produit.ListProduitPane.initGui(ListProduitPane.java:39) | at com.elina.commercialis.client.gui.screens.stock.produit.ListProduitPane.(ListProduitPane.java:31) | at com.elina.commercialis.client.gui.screens.stock.produit.ProduitTab.initGui(ProduitTab.java:63) | at com.elina.commercialis.client.gui.screens.stock.produit.ProduitTab.(ProduitTab.java:51) | at com.elina.commercialis.client.gui.screens.stock.produit.MajProduit.(MajProduit.java:23) | at com.elina.commercialis.client.actions.stock.ProduitAction.showAdminFrane(ProduitAction.java:75) | at com.elina.commercialis.client.actions.stock.ProduitAction.access$0(ProduitAction.java:69) | at com.elina.commercialis.client.actions.stock.ProduitAction$1.run(ProduitAction.java:64) | at java.awt.event.InvocationEvent.dispatch(Unknown Source) | at java.awt.EventQueue.dispatchEvent(Unknown Source) | at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source) | at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) | at java.awt.EventDispatchThread.pumpEvents(Unknown Source) | at java.awt.EventDispatchThread.pumpEvents(Unknown Source) | at java.awt.EventDispatchThread.run(Unknown Source) | Caused by: java.rmi.MarshalException: Failed to communicate. Problem during marshalling/unmarshalling; nested exception is: | java.lang.NullPointerException | at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:287) | at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:131) | at org.jboss.remoting.Client.invoke(Client.java:258) | at org.jboss.remoting.Client.invoke(Client.java:221) | at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:55) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98) | at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98) | at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:55) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98) | at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:65) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98) | at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:102) | ... 19 more | Caused by: java.lang.NullPointerException | at com.elina.commercialis.server.stock.produit.Produit.hashCode(Produit.java:151) | at java.util.HashMap.hash(Unknown Source) | at java.util.HashMap.putForCreate(Unknown Source) | at java.util.HashMap.readObject(Unknown Source) | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) | at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) | at java.lang.reflect.Method.invoke(Unknown Source) | at java.io.ObjectStreamClass.invokeReadObject(Unknown Source) | at java.io.ObjectInputStream.readSerialData(Unknown Source) | at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) | at java.io.ObjectInputStream.readObject0(Unknown Source) | at java.io.ObjectInputStream.defaultReadFields(Unknown Source) | at java.io.ObjectInputStream.readSerialData(Unknown Source) | at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) | at java.io.ObjectInputStream.readObject0(Unknown Source) | at java.io.ObjectInputStream.defaultReadFields(Unknown Source) | at java.io.ObjectInputStream.readSerialData(Unknown Source) | at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) | at java.io.ObjectInputStream.readObject0(Unknown Source) | at java.io.ObjectInputStream.readObject(Unknown Source) | at java.util.HashMap.readObject(Unknown Source) | at sun.reflect.N
[JBoss-user] [EJB 3.0] - ManyToMany biderectional
Hi, I am experiencing the now famous ManyToMany hiberante entity manager bug. I have read the many post on the forum and tried the alternative : using Set instead of collections, using Lazy Fetch type but none of that works for me. The problem is as follow : A product belongs to many Classes of Products A Product belongs to many Famillies of Products So, when creating a product, the product famillies and Classes can be selected. | | import java.io.Serializable; | import java.util.Set; | import java.util.TreeSet; | | import javax.persistence.CascadeType; | import javax.persistence.Column; | import javax.persistence.Entity; | import javax.persistence.FetchType; | import javax.persistence.GeneratedValue; | import javax.persistence.GenerationType; | import javax.persistence.Id; | import javax.persistence.JoinColumn; | import javax.persistence.JoinTable; | import javax.persistence.ManyToMany; | import javax.persistence.OneToOne; | import javax.persistence.Table; | import javax.persistence.Version; | | import com.elina.commercialis.server.stock.classification.Classe; | import com.elina.commercialis.server.stock.classification.Famille; | | @Entity | @Table(name = "produit") | public class Produit implements Serializable, Comparable | { | | private long produitID; | | private String codeProduit; | | private String libelleProduit; | | private Set classes; | | private Set familles; | | private Stock stock; | | private long version; | | public Produit() | { | this.stock = new Stock(); | stock.setProduit(this); | classes = new TreeSet(); | familles = new TreeSet(); | } | | @Version() | @Column(name="version") | public long getVersion() | { | return version; | } | | public void setVersion(long version) | { | this.version = version; | } | | @ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.EAGER) | @JoinTable(name = "classe_produit", |joinColumns = { @JoinColumn(name = "produit_id") }, |inverseJoinColumns = { @JoinColumn(name = "classe_id") }) | public Set getClasses() | { | return classes; | } | | public void setClasses(Set classes) | { | this.classes = classes; | } | | @Column(name = "code_produit") | public String getCodeProduit() | { | return codeProduit; | } | | public void setCodeProduit(String codeProduit) | { | this.codeProduit = codeProduit; | } | | @ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.EAGER ) | @JoinTable(name = "famille_produit", |joinColumns = { @JoinColumn(name = "produit_id") }, |inverseJoinColumns = { @JoinColumn(name = "famille_id") }) | public Set getFamilles() | { | return familles; | } | | public void setFamilles(Set familles) | { | this.familles = familles; | } | | @Column(name = "libelle_produit") | public String getLibelleProduit() | { | return libelleProduit; | } | | public void setLibelleProduit(String libelleProduit) | { | this.libelleProduit = libelleProduit; | } | | @Id | @GeneratedValue(strategy = GenerationType.AUTO) | @Column(name = "produit_id") | public long getProduitID() | { | return produitID; | } | | public void setProduitID(long produitID) | { | this.produitID = produitID; | } | | @OneToOne(cascade = {CascadeType.ALL}) | @JoinColumn(name = "stock_id") | public Stock getStock() | { | return stock; | } | | public void setStock(Stock stock) | { | this.stock = stock; | } | | public boolean equals(Object obj) | { | if(obj == this) | return true; | if(!(obj instanceof Produit)) | return false; | else | return this.getCodeProduit().equalsIgnoreCase(((Produit)obj).getCodeProduit()); | } | | public int hashCode() | { | int result = 17; | result = 37 * result + this.getCodeProduit().hashCode(); | return result; | } | | public String toString() | { | return this.getLibelleProduit(); | } | | public int compareTo(Object obj) | { | if(!(obj instanceof Produit)) |
[JBoss-user] [Installation, Configuration & Deployment] - Localizarion ?
Just a quick one ! How do I get localized error messages from JBoss ? For instance a deployement in a french speaking country would be more usefull with errors in french ! Cheers, View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3890328#3890328 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3890328 --- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence & CMP/JBoss] - Re: MySQL 4/JBoss 3.2.3 and CMP 2.0
Hi, Here is my primary key class : public class ProductPK implements java.io.Serializable { /* * Note that the primary key fields must be a * subset of the the container-managed Bean fields. * The fields we are marking as container-managed in * our Bean are productID, name, desc, and basePrice. * Therefore our PK fields need to be from that set. */ public String productID; public ProductPK(String productID) { this.productID = productID; } public ProductPK() { } public String toString() { return productID.toString(); } public int hashCode() { return productID.hashCode(); } public boolean equals(Object prod) { return ((ProductPK)prod).productID.equals(productID); } } As you can see , it is a valid compound PK class. For the querry, the only querry I could think of that would match the one in the exception is the following from the ejb-jar.xml file : findAllProducts SELECT OBJECT (a) FROM ProductBean AS a WHERE a.productId IS NOT NULL The select clause does select Object (a) View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3836336#3836336 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3836336 --- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence & CMP/JBoss] - Re: MySQL 4/JBoss 3.2.3 and CMP 2.0
Ok, here we go : 1) ejb-jar.xml http://java.sun.com/dtd/ejb-jar_2_0.dtd";> Product Product Product cmptest.ProductHome cmptest.Product cmptest.ProductLocalHome cmptest.ProductLocal cmptest.ProductBean Container cmptest.ProductPK False 2.x ProductBean name description basePrice productId findByName java.lang.String SELECT OBJECT (a) FROM ProductBean AS a WHERE a.name = ?1 findByDescription java.lang.String SELECT OBJECT (a) FROM ProductBean AS a WHERE a.description = ?1 findByBasePrice double SELECT OBJECT (a) FROM ProductBean AS a WHERE a.basePrice = ?1 findExpensiveProducts double SELECT OBJECT (a) FROM ProductBean AS a WHERE a.basePrice > ?1 findCheapProducts double findAllProducts SELECT OBJECT (a) FROM ProductBean AS a WHERE a.productId IS NOT NULL Product * Required 2) jbosscmp-jdbc.xml http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_2.dtd";> java:/DefaultDS mySQL Product products name name description description basePrice basePrice productId productId 3) The stack trace of the exception : javax.ejb.CreateException: Error checking if entity exists:java.sql.SQLException: Syntax error or access violation, message from server: "You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1" at org.jboss.ejb.plugins.cmp.jdbc.JDBCInsertPKCreateCommand.beforeInsert(JDBCInsertPKCreateCommand.java:96) at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.execute(JDBCAbstractCreateCommand.java:137) at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createEntity(JDBCStoreManager.java:554) at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:208) at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.createEntity(CachedConnectionInterceptor.java:269) at org.jboss.ejb.EntityContainer.createHome(EntityContainer.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.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1043) at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:88) at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:197) at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:214) at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:88) at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:89) at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:61) at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:28) at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:88) at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267) at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:98) at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:92) at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:120) at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93) at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:483) at org.jboss.ejb.Container.invoke(Container.java:720) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[JBoss-user] [Persistence & CMP/JBoss] - Re: MySQL 4/JBoss 3.2.3 and CMP 2.0
Well, I don't have the exact exception at hand to post it , but basically the exception is about a SQL Exception ( check the my SQL manual etc..) that is thrown when the create method is called on the bean ! I have configured and deplyed mysql-ds.xml and modified the standard jbosscmp.xml file. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3836223#3836223 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3836223 --- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence & CMP/JBoss] - MySQL 4/JBoss 3.2.3 and CMP 2.0
Has anyone got the configuration working ? I think this might be a bug in JBoss . I tried the confuration for BMP and it is fine. But when it is a CMP , I get lots of SQL Errors, even on create method which SQL Querry is implemented by the container ! View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3836194#3836194 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3836194 --- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence & CMP/JBoss] - Re: problem with creating a record on DB with EJB cmp 2.0
Hi netanelw, I can't get the same type of config (CMP2.0 MySQL, Jboss 3.2.3) to work. Can you hepl ? View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3836198#3836198 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3836198 --- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Installation & Configuration] - Re: MySQL JMS problem?
I am getting the same SQL error when trying to run a CMP 2.0 Entitty bean. It fails on the create method (home.create(param)). It did deploy the MySQL DataSource and change "standardjbosscmp-jdbc.xml" file to point to the deployed data source ! View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3835850#3835850 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3835850 --- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user