This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Which Annotation should be used for @Embedded class when used as primary key ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Which Annotation should be used for @Embedded class when used as primary key ?" Watch "Which Annotation should be used for @Embedded class when used as primary key ?" New topic
Author

Which Annotation should be used for @Embedded class when used as primary key ?

ankur trapasiya
Ranch Hand

Joined: Sep 24, 2010
Posts: 160






There is one table in database UserGroupMaster(UserId,GroupName,Username) in which foreign keys of User(UserId) and Group(GroupName) table resides...Now here there is the entity which is generated from that table .. I have included only important methods only.

Now i am using web services so that whenever i try to run my web application which used web service created from this entity it gives error something like this...

// error
SEVERE: Cannot initialize endpoint : error is :
javax.xml.ws.WebServiceException: Unable to create JAXBContext
at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:166)
at com.sun.xml.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:94)
at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:258)
at com.sun.xml.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:338)
at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:201)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:505)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:560)
at org.glassfish.webservices.EjbRuntimeEndpointInfo.prepareInvocation(EjbRuntimeEndpointInfo.java:278)
at org.glassfish.webservices.Ejb3MessageDispatcher.handlePost(Ejb3MessageDispatcher.java:112)
at org.glassfish.webservices.Ejb3MessageDispatcher.invoke(Ejb3MessageDispatcher.java:87)
at org.glassfish.webservices.EjbWebServiceServlet.dispatchToEjbEndpoint(EjbWebServiceServlet.java:196)
at org.glassfish.webservices.EjbWebServiceServlet.service(EjbWebServiceServlet.java:127)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at com.sun.grizzly.http.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:195)
at com.sun.grizzly.http.servlet.FilterChainImpl.invokeFilterChain(FilterChainImpl.java:139)
at com.sun.grizzly.http.servlet.ServletAdapter.doService(ServletAdapter.java:376)
at com.sun.grizzly.http.servlet.ServletAdapter.service(ServletAdapter.java:329)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:245)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.security.PrivilegedActionException: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
XmlIDREF property is referencing a type "entities.UserGroupMaster" that doesn't have an XmlID property.
this problem is related to the following location:
at public java.util.List entities.LoginMaster.getUserGroupMasterList()
at entities.LoginMaster
at public entities.LoginMaster entities.CitizenMaster.getLoginMaster()
at entities.CitizenMaster
at public entities.CitizenMaster service.jaxws.GetCitizenResponse._return
at service.jaxws.GetCitizenResponse
XmlIDREF property is referencing a type "entities.UserGroupMaster" that doesn't have an XmlID property.
this problem is related to the following location:
at public java.util.List entities.GroupMaster.getUserGroupMasterList()
at entities.GroupMaster
at public entities.GroupMaster entities.UserGroupMaster.getGroupMaster()
at entities.UserGroupMaster
at public java.util.List entities.LoginMaster.getUserGroupMasterList()
at entities.LoginMaster
at public entities.LoginMaster entities.CitizenMaster.getLoginMaster()
at entities.CitizenMaster
at public entities.CitizenMaster service.jaxws.GetCitizenResponse._return
at service.jaxws.GetCitizenResponse
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:153)
... 33 more
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
XmlIDREF property is referencing a type "entities.UserGroupMaster" that doesn't have an XmlID property.
this problem is related to the following location:
at public java.util.List entities.LoginMaster.getUserGroupMasterList()
at entities.LoginMaster
at public entities.LoginMaster entities.CitizenMaster.getLoginMaster()
at entities.CitizenMaster
at public entities.CitizenMaster service.jaxws.GetCitizenResponse._return
at service.jaxws.GetCitizenResponse
XmlIDREF property is referencing a type "entities.UserGroupMaster" that doesn't have an XmlID property.
this problem is related to the following location:
at public java.util.List entities.GroupMaster.getUserGroupMasterList()
at entities.GroupMaster
at public entities.GroupMaster entities.UserGroupMaster.getGroupMaster()
at entities.UserGroupMaster
at public java.util.List entities.LoginMaster.getUserGroupMasterList()
at entities.LoginMaster
at public entities.LoginMaster entities.CitizenMaster.getLoginMaster()
at entities.CitizenMaster
at public entities.CitizenMaster service.jaxws.GetCitizenResponse._return
at service.jaxws.GetCitizenResponse
at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:102)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:472)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:302)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1140)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:154)
at com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:106)
at com.sun.xml.ws.developer.JAXBContextFactory$1.createJAXBContext(JAXBContextFactory.java:109)
at com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:161)
at com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:154)
... 35 more

SEVERE: Unable to find adpater for endpoint



Now i know that this error is occuring due to @XmlID that i have specified. Can anyone please tell that in this case to specify the primary key which annotation i have to use ?

OCPJP(83%)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Which Annotation should be used for @Embedded class when used as primary key ?
 
Similar Threads
EntityManager is null!! what can be the problem?
web services - web logic 10.3.3.0 - spring
Unable to create JAXBContext
Unable to create JAXBContext - Don't know why
Web Service Deployment.