[Persistence, JBoss/CMP, Hibernate, Database] - EJB 2.0: Compound Primary Key and CMR
by fermat42
Hello,
ist it possible with EJB 2.0 and 2 EJBs (CMP) with Compound Primary Keays to
use a CMR? I tried it with Netbeans 5.5 and JBoss 4.0.4. There I got
following error:
| 14:52:27,539 INFO [BaseLocalProxyFactory] Bound EJB
| LocalHome 'StoragePoolBean' to jndi 'local/StoragePoolBean@26869040'
| 14:52:27,544 INFO [ProxyFactory] Bound EJB Home 'StoragePoolBean' to
| jndi 'StoragePoolBean'
| 14:52:27,551 INFO [BaseLocalProxyFactory] Bound EJB
| LocalHome 'VirtualVolumeBean' to jndi 'local/VirtualVolumeBean@31649249'
| 14:52:27,556 INFO [ProxyFactory] Bound EJB Home 'VirtualVolumeBean' to
| jndi 'VirtualVolumeBean'
| org.jboss.deployment.DeploymentException: Both roles of a relation-table
| mapped relationship must have key fields:
| ejb-relation-name=SP-contains-VVs
|
The Beans seem to be o.k., the CMR not. My config:
| <?xml version="1.0" encoding="UTF-8"?>
| <ejb-jar version="2.1" 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/ejb-jar_2_1.xsd">
| <display-name>mda2-EJBModule</display-name>
| <enterprise-beans>
| <entity>
| <display-name>StoragePoolEB</display-name>
| <ejb-name>StoragePoolBean</ejb-name>
| <home>de.virticalsolutions.vdrive.mda.StoragePoolRemoteHome
| </home>
| <remote>de.virticalsolutions.vdrive.mda.StoragePoolRemote
| </remote>
| <local-home>de.virticalsolutions.vdrive.mda.StoragePoolLocalHome
| </local-home>
| <local>de.virticalsolutions.vdrive.mda.StoragePoolLocal
| </local>
| <ejb-class>de.virticalsolutions.vdrive.mda.StoragePoolBean
| </ejb-class>
| <persistence-type>Container
| </persistence-type>
| <prim-key-class>de.virticalsolutions.vdrive.mda.StoragePoolPK
| </prim-key-class>
| <reentrant>false</reentrant>
| <abstract-schema-name>StoragePool</abstract-schema-name>
| [...]
| </entity>
| <entity>
| <display-name>VirtualVolumeEB</display-name>
| <ejb-name>VirtualVolumeBean</ejb-name>
| <home>de.virticalsolutions.vdrive.mda.VirtualVolumeRemoteHome
| </home>
| <remote>de.virticalsolutions.vdrive.mda.VirtualVolumeRemote
| </remote>
| <local-home>
| de.virticalsolutions.vdrive.mda.VirtualVolumeLocalHome
| </local-home>
| <local>de.virticalsolutions.vdrive.mda.VirtualVolumeLocal
| </local>
| <ejb-class>de.virticalsolutions.vdrive.mda.VirtualVolumeBean
| </ejb-class>
| <persistence-type>Container</persistence-type>
| <prim-key-class>de.virticalsolutions.vdrive.mda.VirtualVolumePK
| </prim-key-class>
| <reentrant>false</reentrant>
| <abstract-schema-name>VirtualVolume</abstract-schema-name>
| [...]
| </entity>
| </enterprise-beans>
| <relationships>
| <ejb-relation>
| <description/>
| <ejb-relation-name>SP-contains-VVs</ejb-relation-name>
| <ejb-relationship-role>
| <ejb-relationship-role-name>SPhasVV
| </ejb-relationship-role-name>
| <multiplicity>One</multiplicity>
| <relationship-role-source>
| <ejb-name>StoragePoolBean</ejb-name>
| </relationship-role-source>
| <cmr-field>
| <cmr-field-name>virtualVolumes</cmr-field-name>
| <cmr-field-type>java.util.Collection</cmr-field-type>
| </cmr-field>
| </ejb-relationship-role>
| <ejb-relationship-role>
| <ejb-relationship-role-name>VVinSP
| </ejb-relationship-role-name>
| <multiplicity>Many</multiplicity>
| <relationship-role-source>
| <ejb-name>VirtualVolumeBean</ejb-name>
| </relationship-role-source>
| <cmr-field>
| <cmr-field-name>storagePool</cmr-field-name>
| </cmr-field>
| </ejb-relationship-role>
| </ejb-relation>
| </relationships>
| <assembly-descriptor>
| [...]
| </assembly-descriptor>
| </ejb-jar>
|
===========================================================================
The Primary Keys have no fields of the same name. I also tried to write the
mapping in the jbosscmp-jdbc. As you will see I used e relation-table, no
forign key. But with a forign-key I got the same result. Here is my
jbosscmp-jdbc.xml:
| <jbosscmp-jdbc>
| <relationships>
| <ejb-relation>
| <ejb-relation-name>SP-contains-VVs</ejb-relation-name>
| <relation-table-mapping>
| <table-name>storagepool_has_virtualvolumes</table-name>
| </relation-table-mapping>
| <ejb-relationship-role>
| <ejb-relationship-role-name>SPhasVV
| </ejb-relationship-role-name>
| <key-fields>
| <key-field>
| <field-name>spID</field-name>
| <column-name>storagepool</column-name>
| </key-field>
| <key-field>
| <field-name>spSessionID</field-name>
| <column-name>storagepool_session</column-name>
| </key-field>
| </key-fields>
| </ejb-relationship-role>
| <ejb-relationship-role>
| <ejb-relationship-role-name>VVinSP
| </ejb-relationship-role-name>
| <key-fields>
| <key-field>
| <field-name>vvID</field-name>
| <column-name>virtualvolume</column-name>
| </key-field>
| <key-field>
| <field-name>vvSessionID</field-name>
| <column-name>virtualvolume_session</column-name>
| </key-field>
| </key-fields>
| </ejb-relationship-role>
| </ejb-relation>
| </relationships>
| </jbosscmp-jdbc>
|
===========================================================================
It would be great if someone could explain me what is going wrong here. At
the moment I am thinking about not using CMR and make all the relationships
on my own. But I don't think that it's a good solution because it would be
much more code for me...
bests
Sascha Effert
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4024305#4024305
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4024305
17Â years, 10Â months
[JBossWS] - Re: Using rpc/encoded
by mikaelstaldal
When I try to deploy a WebService annotated with
@SOAPBinding(style=Style.RPC,use=Use.ENCODED)
i get this error:
| 16:25:25,676 ERROR [MainDeployer] Could not create deployment: file:/usr/local/share/java/jboss-4.0.5.GA/server/pf3/deploy/enecto/pf3-ws.war
| org.jboss.deployment.DeploymentException: Cannot create service endpoint; - nested throwable: (org.jboss.ws.WSException: SOAP encoding is not supported for JSR-181 deployments)
| at org.jboss.deployment.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:53)
| ...
| Caused by: org.jboss.ws.WSException: SOAP encoding is not supported for JSR-181 deployments
| at org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilder.processSOAPBinding(JAXWSMetaDataBuilder.java:130)
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4024304#4024304
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4024304
17Â years, 10Â months
[JBossCache] - EvictionPolicyConfig
by kevinstembridge
Hi all,
I'm having trouble getting an eviction policy to work properly for objects that are not in a top-level tree node.
I'm using JBossCache as the 2nd-level cache for Hibernate. So, for example, if I am caching an object called my.package.MyClass, it ends up in a cache region called /my/package/MyClass. To set up an eviction policy for this region I am using the following config:
| <attribute name="EvictionPolicyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
| <!-- Specific eviction policy configurations. This is LRU -->
| <attribute name="EvictionPolicyConfig">
| <config>
| <attribute name="wakeUpIntervalSeconds">5</attribute>
| <!-- Cache wide default -->
| <region name="/_default_">
| <attribute name="maxNodes">5000</attribute>
| <attribute name="timeToLiveSeconds">30</attribute>
| </region>
| <region name="/my/package/MyClass" >
| <attribute name="maxNodes">10000</attribute>
| <attribute name="timeToLiveSeconds">10</attribute>
| <attribute name="maxAgeSeconds">10</attribute>
| </region>
| </config>
| </attribute>
|
But the result I'm seeing is that the eviction policy for the specific region is not applied.
However, things work fine if I tell Hibernate to store objects in a top-level region (i.e. not nested) and provide an eviction policy for that region.
BTW, using JBossCache 1.4 with Hibernate 3.2.0 in JBoss 4.0.5.
Any help is much appreciated.
Kevin
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4024297#4024297
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4024297
17Â years, 10Â months
[Beginners Corner] - Re: Migrating JavaBean <resource-ref>s from Tomcat to JBoss
by pdanielsen
Thanks for replying.
I've already added a <resource-ref> to the jboss-web.xml file. Here's an example. The web.xml contains this:
| <resource-ref>
| <description>Logger Service Locator Configuration Bean Factory</description>
| <res-ref-name>bean/LoggerServiceLocatorConfigBeanFactory</res-ref-name>
| <res-type>com.xyz.test.webapp.LoggerServiceLocatorConfigBean</res-type>
| <res-auth>Container</res-auth>
| </resource-ref>
|
where the res-type is the name of a JavaBean class that contains configuration data. It's not an EJB, just a regular JavaBean.
The jboss-web.xml contains this:
| <resource-ref>
| <res-ref-name>bean/LoggerServiceLocatorConfigBeanFactory</res-ref-name>
| <jndi-name>java:/bean/LoggerServiceLocatorConfigBeanFactory</jndi-name>
| </resource-ref>
|
to map the res-ref-name to a JNDI name.
I'm trying to understand where and how I specify
1. the properties of this JavaBean in JBoss?
2. the factory JBoss should use to create the bean?
The JBoss documentation I've found so far only takes me through the jboss-web.xml step, but doesn't explain how values are assigned to JNDI names. In Tomcat, an application-specific context file under $TOMCAT/conf/Catalina/localhost identifies the factory and the JavaBean properties, as shown in the documentation referenced in my original post. I also looked at WebSphere and saw how to do both these actions there, so I'm thinking there must be a similar feature in JBoss.
Thanks again for your assistance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4024294#4024294
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4024294
17Â years, 10Â months
[JBoss Seam] - Re: LocaleSelector
by baz
Good and bad news from me.
Localisation works for me only with normal resource bundles.
Now i have detected that it do not work with the seam resource bundle named messages.
I do have a form like this (bundle is the bundle loaded with f:loadbundle):
<s:validateAll>
| <h:panelGrid border="1" cellspacing="2" id="User" columns="3">
| <h:outputLabel value="#{bundle.userlogin}" for="login" />
| <h:inputText id="login" value="#{myUser.login}" required="true">
| <f:validateLength minimum="5" maximum="30" />
| </h:inputText>
| <h:message for="login" styleClass="errors" />
|
| <h:outputLabel value="#{bundle.userpassword}" for="password" />
| <h:inputText id="password" value="#{myUser.password}" />
| <h:message for="password" styleClass="errors" />
| </h:panelGrid>
| </s:validateAll>
|
Now this happens:
The error message for the login field is taken from my bundle and displayed in the language selected with the localeselector.
The error message for password is taken from the seam messages bundle and displayed in the browsers default language. (regardless of the selection with the localeselector:-)
What is going wrong here?
Ciao,
Carsten
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4024293#4024293
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4024293
17Â years, 10Â months