[EJB 3.0] - Entity bean cascade design issue
by alexg79
I'm sure that a lot of others have run into the same problem as I have.
Suppose you have three entity bean classes: Employee, Customer, Order.
an Order is associated to one Employee and one Customer.
What if an employee who has associated orders gets fired? You can't simply delete his Employee record, because the association from Order prevents it. Orders may not be deleted because you have to keep them all for statistics.
I can think of three ways to handle this:
1. Have the code that removes the Employee nullify the connection to the Employee
2. Use weak references instead (store the ID of the Employee without a foreign key constraint)
3. Use a unidirectional one-to-many association
Problems:
1. Not very scalable, since you have to remember to only remove the entities in question through one specific method, and the method has to know of every single association
2. Can leave dangling IDs behind when the target is removed, and references require explicit queries
3. Ugly, not spec compliant and requires an additional table per association, and association is not visible from the Order object
Is there nothing like "ON DELETE SET NULL" for EJB 3.0 persistence, or Hibernate?
Do I have to resort to native SQL for this?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3987569#3987569
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3987569
19Â years, 5Â months
[J2EE Design Patterns] - Re: newb EJB 3 Design Pattern question
by chrisodom
Falling back to the J2EE design patterns and using Stateless Session Beans as a Session Facades you have the ability to expose methods with security constraints as WebServices end points using a broker. With this in mind you now are able to use the JAXB bind objects as transfer objects which simplifies the marshalling of responses back to the Client.
This type of implementation also allows for re-use of the Session Facade method calls by Business Delegates. Interfacing your Session Facades you can create 2 constructs for both Local (Business Delegates) and Remote (Web Services calls). This allow you to annotate your security framework for the particular calls that are being made.
The EJB3 implementation does not the J2EE patterns but has only simplified the Containers implementation making the Bean Context a more managable and flexible framework. Please do not disregard your thoughts on using J2EE patterns these are still valid with the new EJB3 paradigm.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3987566#3987566
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3987566
19Â years, 5Â months
[JBoss Eclipse IDE (users)] - Project structure with packaging configuration versus Eclips
by mraben
Hi,
I have read the Eclipse "Project configuration tutorial" in the "Java Development User Guide".
I would like to have one java project with the whole source of
20 big ejb modules, and some war applications, so i thought of this project structure.
The problem is, with so many different projects, because every modul is a project in its own,everything gets very confusing.
I have seen that the JBossIde (2.0.0beta2) allows to specify "package configuration" inside one project consisting of many modules.
Do you use this packaging, and what do you think about it?
How would you structure such a project?
Eclipse 3.2 Project with source linking:
java project: server_source:
src/com/../module1
src/com/../module2
src/com/../module3
src/com/../module4
...
src/com/../module20
j2ee modul projects:
module1: 1. link source: to server_source/src/com/../module1/*
2. required projects on build path: server_source: access rule: forbidden:server_source/src/com/../module1/*
module2 ...
module3 ...
module4 ...
...
module20 ...
JBOSSIDE using packaging configuration:
j2ee mainproject: package configuration for deployment of modules.
ejbmodul1
ejbmodul2
ejbmodul3
ejbmodul4
ejbmodul5
Greetings,
Markus
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3987563#3987563
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3987563
19Â years, 5Â months
[JBossWS] - Interfaces in Webmethods
by wconroy
I have an EJB that exposes only interfaces that I want to wrap with a webservice. I made the following to illustrate what I am trying to do. I have an app that invokes the web service that gives me the following exception.
| 07:59:52,873 ERROR [SOAPFaultExceptionHelper] SOAP request exception
| javax.xml.rpc.JAXRPCException: org.jboss.ws.binding.BindingException: org.jboss.ws.jaxb.UnmarshalException: Failed to parse source: Class com.bo.valueobjects.PersonRequest has no public constructors or the class reflects a primitive type or void
| at org.jboss.ws.soap.SOAPContentElement.getObjectValue(SOAPContentElement.java:292)
| at org.jboss.ws.binding.EndpointInvocation.transformPayloadValue(EndpointInvocation.java:233)
| at org.jboss.ws.binding.EndpointInvocation.getRequestParamValue(EndpointInvocation.java:103)
| at org.jboss.ws.binding.EndpointInvocation.getRequestPayload(EndpointInvocation.java:117)
| at org.jboss.ws.integration.jboss.ServiceEndpointInvokerEJB3.invokeServiceEndpoint(ServiceEndpointInvokerEJB3.java:115)
| at org.jboss.ws.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:115)
| at org.jboss.ws.server.ServiceEndpoint.handleRequest(ServiceEndpoint.java:219)
| at org.jboss.ws.server.ServiceEndpointManager.processSOAPRequest(ServiceEndpointManager.java:355)
| at org.jboss.ws.server.StandardEndpointServlet.doPost(StandardEndpointServlet.java:115)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
| at org.jboss.ws.server.StandardEndpointServlet.service(StandardEndpointServlet.java:76)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:595)
| Caused by: org.jboss.ws.binding.BindingException: org.jboss.ws.jaxb.UnmarshalException: Failed to parse source: Class com.bo.valueobjects.PersonRequest hasno public constructors or the class reflects a primitive type or void
| at org.jboss.ws.jaxrpc.encoding.JAXBDeserializer.deserialize(JAXBDeserializer.java:100)
| at org.jboss.ws.soap.SOAPContentElement.getObjectValue(SOAPContentElement.java:229)
| ... 29 more
| Caused by: org.jboss.ws.jaxb.UnmarshalException: Failed to parse source: Class com.bo.valueobjects.PersonRequest has no public constructors or the class reflects a primitive type or void
| at org.jboss.ws.jaxb.JBossXBUnmarshallerImpl.unmarshal(JBossXBUnmarshallerImpl.java:67)
| at org.jboss.ws.jaxrpc.encoding.JAXBDeserializer.deserialize(JAXBDeserializer.java:92)
| ... 30 more
| Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: Class com.bo.valueobjects.PersonRequest has no public constructors or the class reflects a primitive type or void
| at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:178)
| at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:126)
| at org.jboss.ws.jaxb.JBossXBUnmarshallerImpl.unmarshal(JBossXBUnmarshallerImpl.java:63)
| ... 31 more
| Caused by: org.jboss.xb.binding.JBossXBRuntimeException: Class com.bo.valueobjects.PersonRequest has no public constructors or the class reflects a primitive type or void
| at org.jboss.xb.binding.sunday.unmarshalling.impl.runtime.RtElementHandler.newInstance(RtElementHandler.java:961)
| at org.jboss.xb.binding.sunday.unmarshalling.impl.runtime.RtElementHandler.startElement(RtElementHandler.java:728)
| at org.jboss.xb.binding.sunday.unmarshalling.impl.runtime.RtElementHandler.startParticle(RtElementHandler.java:89)
| at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:504)
| at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.startElement(SaxJBossXBParser.java:323)
| at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
| at org.apache.xerces.xinclude.XIncludeHandler.startElement(Unknown Source)
| at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
| at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
| at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
| at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
| at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
| at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
| at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
| at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
| at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:174)
| ... 33 more
|
Is there a way that I can generate the WSDL in a way that the request can be properly resolved? Are there different annotations I could be using?
For now, I am just deploying a jar with this service and letting JBoss generate the wsdl at deploy time.
| public interface PersonRequest {
|
| public String getSsn();
| public void setSsn(String ssn);
|
| }
|
| public class PersonRequestImpl implements PersonRequest {
|
| private String ssn;
|
| public String getSsn() {
| return ssn;
| }
|
| public void setSsn(String ssn) {
| this.ssn = ssn;
| }
|
| }
|
| @Local
| public interface PeopleService {
|
| public String getPersonName(PersonRequest request);
|
| }
|
| @Stateless
| @WebService(name="PeopleService", targetNamespace="http://com.bo/peopleService")
| public class PeopleServiceImpl implements PeopleService {
|
| @WebMethod
| public String getPersonName(PersonRequest request) {
| Logger.getLogger(getClass()).info("Request class: " + request.getClass());
| return "MyName";
| }
|
| }
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3987557#3987557
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3987557
19Â years, 5Â months
[EJB/JBoss] - 'java.lang.IllegalArgumentException: null object name' when
by rixc
Hi all,
Jboss version is 4.0.2. JDK is 1.4.2
I am getting this errror when a class in the Jboss container is trying to instantiate an EJB. The same code used to work on Jboss 3.2.x. I tried putting Jboss in Debug mode but I dont get any more information.
Are there other traces I can enable to show me more information?
The concerned trace is below
| 2006-11-21 14:54:50,362 ERROR [java.lang.String] com.odcgroup.mms.exceptions.osf.OsfGeneralException(7918822)(9573d78f0f71e750): OsfGeneralException while calling method [Error creating remote interface.]
| PREVIOUS: java.lang.reflect.InvocationTargetException(14767255): null
| SOURCE: java.lang.String#getRemote
| CONTEXT[0]: java.lang.String: Error creating remote interface.
| com.odcgroup.mms.exceptions.osf.OsfGeneralException(7918822)(9573d78f0f71e750): OsfGeneralException while calling method [Error creating remote interface.]
| at com.odc.server.ejb.pool.SessionAdaptorPool.getRemote(SessionAdaptorPool.java:340)
| at com.odc.server.ejb.pool.SessionAdaptorPool.invokeService(SessionAdaptorPool.java:133)
| at com.odc.server.ejb.session.ServerObjectFactoryBean.getService(Unknown Source)
| 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.invocation.Invocation.performCall(Invocation.java:345)
| at org.jboss.ejb.StatefulSessionContainer$ContainerInterceptor.invoke(StatefulSessionContainer.java:584)
| at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:139)
| at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
| at org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor.invoke(StatefulSessionInstanceInterceptor.java:297)
| at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
| at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105)
| at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335)
| at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166)
| at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
| at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
| at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
| at org.jboss.ejb.Container.invoke(Container.java:873)
| 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:249)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
| at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:805)
| at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:406)
| 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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
| at sun.rmi.transport.Transport$1.run(Transport.java:148)
| at java.security.AccessController.doPrivileged(Native Method)
| at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
| at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
| at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
| at java.lang.Thread.run(Thread.java:534)
| Caused by: java.lang.reflect.InvocationTargetException
| 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 com.odc.server.ejb.pool.SessionAdaptorPool.getRemote(SessionAdaptorPool.java:335)
| ... 41 more
| Caused by: java.lang.IllegalArgumentException: null object name
| at org.jboss.mx.server.registry.BasicMBeanRegistry.get(BasicMBeanRegistry.java:495)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:638)
| at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:805)
| at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:406)
| at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:118)
| at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:227)
| at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:167)
| at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
| at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
| at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:169)
| at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)
| at $Proxy168.create(Unknown Source)
| ... 46 more
Ricardo
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3987556#3987556
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3987556
19Â years, 5Â months