[EJB 3.0] - Re: Attribute from MappedClass as a part of composit PK ?
by Wolfgang Knauf
Hi Dalibor,
one more idea, which might prevent you from duplicating the fields:
Instead of an EmbeddedId, use an IdClass (annotate the entity with "IdClass"). This class will have the same fields as the EmbeddedId, but no further annotations.
All primary key fields are part of your entity. The timestamp property has to be copied to the subclass, best with an @Override annotation, and getter/setter just call the base class methods.
Here is a snippet:
| public class MyId implements Serializable
| {
| public TimeStamp getSomething()
| {
| ...
| }
| public Integer getOtherIdFields()
| {
| ...
| }
| }
|
| @IdClass(value=MyId.class)
| public MyEntity extends BaseEntity implements Serializeable
| {
| @Id
| @Override
| public TimeStamp getSomething()
| {
| return super.getSomething();
| }
| ...setter...
|
The ID class is required to make "entityManager.find" work, and inserting of entities will not work without. So you need the ID class even if your code does not need it.
Hope this helps (and works ;-) )
Wolfgang
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4239066#4239066
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4239066
16 years, 10 months
[JBoss/Spring Integration] - Re: Spring Component Auto Detection
by mike_mackey
Hi ...
I'm a bit of a noob w.r.t. alot of this so apologies if this question is obvious or silly.
I've been trying to get a simple sample application running with JBoss 5.0 and Spring 2.5.6. I have used the fix provided in https://jira.jboss.org/jira/browse/JBSPRING-4 and my Root WebApplicationContext is started and created correctly using VFSXmlWebApplicationContext.
However when it tries to create the servlet it reverts back to XmlWebApplicationContext and I get afore mentioned FileNotFoundException.
Any help would be greatly appreciated !
web.xml
| <?xml version="1.0" encoding="ISO-8859-1"?>
|
| <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
| http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
| version="2.4">
|
| <listener>
| <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
| </listener>
|
| <context-param>
| <param-name>contextClass</param-name>
| <param-value>org.jboss.spring.factory.VFSXmlWebApplicationContext</param-value>
| </context-param>
|
| <context-param>
| <param-name>contextConfigLocation</param-name>
| <param-value>
| /WEB-INF/applicationContext*.xml
| </param-value>
| </context-param>
|
| <servlet>
| <servlet-name>amartus</servlet-name>
| <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
| <load-on-startup>1</load-on-startup>
| </servlet>
|
| <servlet-mapping>
| <servlet-name>amartus</servlet-name>
| <url-pattern>*.html</url-pattern>
| </servlet-mapping>
|
| <servlet>
| <servlet-name>service</servlet-name>
| <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
| <load-on-startup>2</load-on-startup>
| </servlet>
|
| <servlet-mapping>
| <servlet-name>service</servlet-name>
| <url-pattern>/service/*</url-pattern>
| </servlet-mapping>
|
| <welcome-file-list>
| <welcome-file>index.jsp</welcome-file>
| </welcome-file-list>
|
| </web-app>
|
Trace ...
| 12:41:04,162 INFO [STDOUT] 22-Jun-2009 12:41:04 DEBUG [ContextLoader] - <Published root WebApplicationContext as ServletContext attribute with name [org.springframework.web.context.WebApplicationContext.ROOT]>
| 12:41:04,162 INFO [STDOUT] 22-Jun-2009 12:41:04 INFO [ContextLoader] - <Root WebApplicationContext: initialization completed in 6915 ms>
| 12:41:04,193 INFO [STDOUT] 22-Jun-2009 12:41:04 DEBUG [DispatcherServlet] - <Initializing servlet 'amartus'>
| 12:41:04,215 INFO [spring]] Initializing Spring FrameworkServlet 'amartus'
| 12:41:04,215 INFO [STDOUT] 22-Jun-2009 12:41:04 INFO [DispatcherServlet] - <FrameworkServlet 'amartus': initialization started>
| 12:41:04,216 INFO [STDOUT] 22-Jun-2009 12:41:04 DEBUG [DispatcherServlet] - <Servlet with name 'amartus' will try to create custom WebApplicationContext context of class 'org.springframework.web.context.support.XmlWebApplicationContext', using parent context [org.jboss.spring.factory.VFSXmlWebApplicationContext@185fdbe: display name [Root WebApplicationContext]; startup date [Mon Jun 22 12:40:57 BST 2009]; root of context hierarchy]>
| 12:41:04,221 INFO [STDOUT] 22-Jun-2009 12:41:04 INFO [XmlWebApplicationContext] - <Refreshing org.springframework.web.context.support.XmlWebApplicationContext@9a34a0: display name [WebApplicationContext for namespace 'amartus-servlet']; startup date [Mon Jun 22 12:41:04 BST 2009]; parent: org.jboss.spring.factory.VFSXmlWebApplicationContext@185fdbe>
| 12:41:04,222 INFO [STDOUT] 22-Jun-2009 12:41:04 INFO [XmlBeanDefinitionReader] - <Loading XML bean definitions from ServletContext resource [/WEB-INF/amartus-servlet.xml]>
| 12:41:04,225 INFO [STDOUT] 22-Jun-2009 12:41:04 DEBUG [DefaultDocumentLoader] - <Using JAXP provider [org.apache.xerces.jaxp.DocumentBuilderFactoryImpl]>
| 12:41:04,227 INFO [STDOUT] 22-Jun-2009 12:41:04 DEBUG [PluggableSchemaResolver] - <Loading schema mappings from [META-INF/spring.schemas]>
| 12:41:04,300 INFO [STDOUT] 22-Jun-2009 12:41:04 DEBUG [PluggableSchemaResolver] - <Loaded schema mappings: {http://www.springframework.org/schema/lang/spring-lang-2.5.xsd=org/springframework/scripting/config/spring-lang-2.5.xsd, http://www.springframework.org/schema/lang/spring-lang.xsd=org/springfram..., http://www.springframework.org/schema/context/spring-context-2.5.xsd=org/..., http://www.springframework.org/schema/jms/spring-jms-2.5.xsd=org/springfr..., http://www.springframework.org/schema/context/spring-context.xsd=org/spri..., http://www.springframework.org/schema/aop/spring-aop.xsd=org/springframew..., http://www.springframework.org/schema/util/spring-util-2.0.xsd=org/spring..., http://www.springframework.org/schema/util/spring-util-2.5.xsd=org/spring..., http://www.springframework.org/schema/tx/spring-tx-2.0.xsd=org/springfram..., http://www.springframework.org/schema/tool/spring-tool-2.0.xsd=org/spring..., http://www.springframework.org/schema/tx/spring-tx-2.5.xsd=org/springfram..., http://www.springframework.org/schema/beans/spring-beans-2.0.xsd=org/spri..., http://www.springframework.org/schema/tool/spring-tool-2.5.xsd=org/spring..., http://www.springframework.org/schema/jms/spring-jms.xsd=org/springframew..., http://www.springframework.org/schema/beans/spring-beans-2.5.xsd=org/spri..., http://www.springframework.org/schema/jee/spring-jee.xsd=org/springframew..., http://www.springframework.org/schema/beans/spring-beans.xsd=org/springfr..., http://www.springframework.org/schema/tool/spring-tool.xsd=org/springfram..., http://www.springframework.org/schema/tx/spring-tx.xsd=org/springframewor..., http://www.springframework.org/schema/jee/spring-jee-2.0.xsd=org/springfr..., http://www.springframework.org/schema/aop/spring-aop-2.0.xsd=org/springfr..., http://www.springframework.org/schema/aop/spring-aop-2.5.xsd=org/springfr..., http://www.springframework.org/schema/jee/spring-jee-2.5.xsd=org/springfr..., http://www.springframework.org/schema/lang/spring-lang-2.0.xsd=org/spring..., http://www.springframework.org/schema/util/spring-util.xsd=org/springfram...>
| 12:41:04,301 INFO [STDOUT] 22-Jun-2009 12:41:04 DEBUG [PluggableSchemaResolver] - <Found XML schema [http://www.springframework.org/schema/beans/spring-beans-2.5.xsd] in classpath: org/springframework/beans/factory/xml/spring-beans-2.5.xsd>
| 12:41:04,309 INFO [STDOUT] 22-Jun-2009 12:41:04 DEBUG [PluggableSchemaResolver] - <Found XML schema [http://www.springframework.org/schema/context/spring-context-2.5.xsd] in classpath: org/springframework/context/config/spring-context-2.5.xsd>
| 12:41:04,351 INFO [STDOUT] 22-Jun-2009 12:41:04 DEBUG [PluggableSchemaResolver] - <Found XML schema [http://www.springframework.org/schema/aop/spring-aop-2.5.xsd] in classpath: org/springframework/aop/config/spring-aop-2.5.xsd>
| 12:41:04,354 INFO [STDOUT] 22-Jun-2009 12:41:04 DEBUG [DefaultBeanDefinitionDocumentReader] - <Loading bean definitions>
| 12:41:04,380 INFO [STDOUT] 22-Jun-2009 12:41:04 DEBUG [DefaultNamespaceHandlerResolver] - <Loaded mappings [{http://www.springframework.org/schema/p=org.springframework.beans.factory.xml.SimplePropertyNamespaceHandler, http://www.springframework.org/schema/lang=org.springframework.scripting...., http://www.springframework.org/schema/jee=org.springframework.ejb.config...., http://www.springframework.org/schema/aop=org.springframework.aop.config...., http://www.springframework.org/schema/jms=org.springframework.jms.config...., http://www.springframework.org/schema/util=org.springframework.beans.fact..., http://www.springframework.org/schema/tx=org.springframework.transaction...., http://www.springframework.org/schema/context=org.springframework.context...]>
| 12:41:04,401 INFO [STDOUT] 22-Jun-2009 12:41:04 DEBUG [PathMatchingResourcePatternResolver] - <Cannot search for matching files underneath URL [vfsfile:/C:/dev/jboss-5.0.0.GA/server/default/deploy/common-mgt-fw.spring/WEB-INF/classes/com/amartus/web/] because it does not correspond to a directory in the file system>
| java.io.FileNotFoundException: URL [vfsfile:/C:/dev/jboss-5.0.0.GA/server/default/deploy/common-mgt-fw.spring/WEB-INF/classes/com/amartus/web/] cannot be resolved to absolute file path because it does not reside in the file system: vfsfile:/C:/dev/jboss-5.0.0.GA/server/default/deploy/common-mgt-fw.spring/WEB-INF/classes/com/amartus/web/
| at org.springframework.util.ResourceUtils.getFile(ResourceUtils.java:201)
| at org.springframework.core.io.UrlResource.getFile(UrlResource.java:156)
| at org.springframework.core.io.support.PathMatchingResourcePatternResolver.doFindPathMatchingFileResources(PathMatchingResourcePatternResolver.java:517)
|
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4239063#4239063
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4239063
16 years, 10 months
[JBoss Messaging] - Re: Queues Grouping in JBoss Messaging 1.4
by timfox
"unwavering" wrote : Dear respectable community,
|
| I have a project in which JBoss Messaging 1.4 will be used as the messaging component. One of the requirements is to define different groups of queues for different parties. The purpose of the grouping concept is facilitate queues management by centralizing administration for each party under a group. Does JBoss Messaging 1.4 provides the capability of queues grouping?
|
| I found that JBoss Messaging 2 provides a similar concept by using a file called queues.xml which contains centralized queues configuration and security using wildcards. Is there a similar thing in JBoss 1.4 release?
|
| Thanks a lot for your time.
I'm not sure I really understand your question, but if you're asking whether JBM 1.x supports different sets of queues being deployed from different files, then the answer is yes.
In JBM 1.x all queues are just MBeans and can be declared in as many files as you like.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4239060#4239060
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4239060
16 years, 10 months