[JBoss Seam] - How to add two entities home in the same page?
by fredbene
Hello,
I have my page that I want to add a person and his phone.
I would like to know what I need to do when I call my #{personHome.persist} save my #{personHome.instance.name} , #{personHome.instance.age} WITH #{phoneHome.instance.number} as you can see in my page.
| <ui:define name="body">
|
| <h:messages/>
|
| <center>
| <h:outputText value="Add new Person"
| rendered="#{!personHome.managed}"/>
| </center>
|
| <h:form id="person">
|
| <s:validateAll>
| <h:panelGrid columns="2">
| <h:outputLabel for="name">
| Name:
| </h:outputLabel>
| <s:decorate id="nameDecorator">
| <h:inputText value="#{personHome.instance.name}" required="true"/>
| </s:decorate>
|
| <h:outputLabel for="age">
| Age:
| </h:outputLabel>
| <s:decorate id="ageDecorator">
| <h:inputText value="#{personHome.instance.age}" required="true"/>
| </s:decorate>
|
| <h:outputLabel for="house">
| Phone:
| </h:outputLabel>
|
| <s:decorate id="numberDecorator">
| <h:inputText value="#{phoneHome.instance.number}"/>
| </s:decorate>
|
|
| </h:panelGrid>
| </s:validateAll>
| <center>
| <h:commandButton action="#{personHome.persist}" value="Save"/>
| <h:commandButton action="#{personHome.remove}" value="Delete"/>
| </center>
|
| </h:form>
|
| </ui:define>
|
My PersonHome
| @Name("personHome")
| public class PersonHome extends EntityHome<Person> {
|
| public void setPersonId(Integer id) {
| setId(id);
| }
|
| public Integer getPersonId() {
| return (Integer)getId();
| }
|
| @Override
| protected Person createInstance() {
| Person person = new Person();
| return person;
| }
| }
|
|
My phoneHome
| @Name("phoneHome")
| public class PhoneHome extends EntityHome<Phone> {
|
| public void setPhoneId(Integer id) {
| setId(id);
| }
|
| public Integer getPhoneId() {
| return (Integer)getId();
| }
|
| @Override
| protected Phone createInstance() {
| Phone phone = new Phone();
| return phone;
| }
| }
|
And how is mappend my Person and Phone
|
| Person:
|
| @OneToMany(mappedBy="owner", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
| public List<Phone> getPhones() {
| return phones;
| }
| public void setPhones(List<Phone> phones) {
| this.phones = phones;
| }
|
|
| Phones
|
| @ManyToOne(fetch=FetchType.LAZY)
| @JoinColumn(name="person_id", nullable=false)
| public Person getowner() {
| return owner;
| }
| public void setOwner(Person owner) {
| this.owner = owner;
| }
|
Thank you,
Frederico
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4025863#4025863
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4025863
19Â years, 1Â month
[JBoss Seam] - Re: How to deploy seam with oracle as ( or oc4j)?
by apushadow
Did anyone actually get this working? I'm getting the oh-so-(not)-helpful error message:
Exception creating EntityManagerFactory using PersistenceProvider class org.hibernate.ejb.HibernatePersistence for persistence unit myDatabase.
My app works great on Tomcat, but gives me this error when I try to deploy it on OC4J using their admin web-front-end. I was at least able to get OC4J working with MySQL (by adding the driver jar to the correct directory, adding the information to data-sources.xml, restarting the server, and testing it successfully via the front end), which got me past the "adaptor cannot connect to database" error.
I'm currently using JBoss's EJB3 implementation...is it necessary to use Oracle's? If so, how do I go about configuring my app to use it?
--Rich
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4025859#4025859
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4025859
19Â years, 1Â month
[EJB 3.0] - Using a parameter as order by column
by milestone
Hi all,
I am developing a Rich Client talking to my jboss server via Session Beans. Now within my Session Bean, I have the following Function:
| public List<Domaindata> getAllDomains(String orderByColumn)
| {
| Query query = em.createQuery("select d from Domaindata AS d ORDER BY :column");
| query.setParameter("column", orderByColumn);
|
| return query.getResultList();
| }
|
on the client side i am calling this function through its remote interface
| DomainRobotRemote robot = CommunicationHandler.getInstance().getDomainRobot();
| List<Domaindata> domains = robot.getAllDomains("name");
| for (Domaindata d : domains)
| {
| theNode.add(new DefaultMutableTreeNode(d.getName()));
| }
|
I can see the query translated by hibernate as
| 16:08:06,302 INFO [STDOUT] Hibernate: select ... borc.DOMAINDATA domaindata0_ order by ?
|
but the result list is not ordered.
If I explicitly order by a specific domain as in
| public List<Domaindata> getAllDomainsByName()
| {
| return em.createQuery("from Domaindata domain order by domain.name").getResultList();
| }
|
Everything is working fine. Isn't it possible to dynamically say what Column I want the Result list to be orderd by?
Any Help is highly appreciated.
Juergen
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4025856#4025856
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4025856
19Â years, 1Â month
[JBoss Messaging] - Re: Message bridge
by timfox
Yes, 1.2 GA includes a fully functioning message bridge, although it's not currently included in the documentation due to time constraints on the 1.2 release. We will remedy this shortly.
It's pretty straightforward to setup. Basically it's installed as an MBean. Here's the xmbean description from the distro:
| <?xml version="1.0" encoding="UTF-8"?>
| <!DOCTYPE mbean PUBLIC
| "-//JBoss//DTD JBOSS XMBEAN 1.2//EN"
| "http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_2.dtd">
|
| <mbean>
| <description>A JMS Message Bridge</description>
| <class>org.jboss.server.bridge.BridgeService</class>
|
| <!-- Managed constructors -->
|
| <!-- Managed attributes -->
|
| <attribute access="read-only" getMethod="getInstance">
| <description>Gets the underlying instance</description>
| <name>Instance</name>
| <type>org.jboss.messaging.core.plugin.contract.MessagingComponent</type>
| </attribute>
|
| <attribute access="read-write" getMethod="getSourceProviderAdaptorLookup"
| setMethod="setSourceProviderAdaptorLookup">
| <description>JNDI lookup for the source JMS provider Adaptor</description>
| <name>SourceProviderAdaptorLookup</name>
| <type>java.lang.String</type>
| </attribute>
|
| <attribute access="read-write" getMethod="getTargetProviderAdaptorLookup"
| setMethod="setTargetProviderAdaptorLookup">
| <description>JNDI lookup for the target JMS provider Adaptor</description>
| <name>TargetProviderAdaptorLookup</name>
| <type>java.lang.String</type>
| </attribute>
|
| <attribute access="read-write" getMethod="getSourceDestinationLookup"
| setMethod="setSourceDestinationLookup">
| <description>The source destination lookup</description>
| <name>SourceDestinationLookup</name>
| <type>java.lang.String</type>
| </attribute>
|
| <attribute access="read-write" getMethod="getTargetDestinationLookup"
| setMethod="setTargetDestinationLookup">
| <description>The target destination lookup</description>
| <name>TargetDestinationLookup</name>
| <type>java.lang.String</type>
| </attribute>
|
| <attribute access="read-write" getMethod="getSourceUsername"
| setMethod="setSourceUsername">
| <description>The source username</description>
| <name>SourceUsername</name>
| <type>java.lang.String</type>
| </attribute>
|
| <attribute access="read-write" getMethod="getSourcePassword"
| setMethod="setSourcePassword">
| <description>The source username</description>
| <name>SourcePassword</name>
| <type>java.lang.String</type>
| </attribute>
|
| <attribute access="read-write" getMethod="getTargetUsername"
| setMethod="setTargetUsername">
| <description>The target username</description>
| <name>TargetUsername</name>
| <type>java.lang.String</type>
| </attribute>
|
| <attribute access="read-write" getMethod="getTargetPassword"
| setMethod="setTargetPassword">
| <description>The target password</description>
| <name>TargetPassword</name>
| <type>java.lang.String</type>
| </attribute>
|
| <attribute access="read-write" getMethod="getQualityOfServiceMode"
| setMethod="setQualityOfServiceMode">
| <description>The quality of service mode. 0 = at most once. 1 = duplicates ok, 2 = once and only once</description>
| <name>QualityOfServiceMode</name>
| <type>int</type>
| </attribute>
|
| <attribute access="read-write" getMethod="getSelector"
| setMethod="setSelector">
| <description>The JMS selector to use when consuming messages from the source destination</description>
| <name>Selector</name>
| <type>java.lang.String</type>
| </attribute>
|
| <attribute access="read-write" getMethod="getMaxBatchSize"
| setMethod="setMaxBatchSize">
| <description>The maximum number of messages to forward at a time, must be >= 1</description>
| <name>MaxBatchSize</name>
| <type>int</type>
| </attribute>
|
| <attribute access="read-write" getMethod="getMaxBatchTime"
| setMethod="setMaxBatchTime">
| <description>Number of milliseconds to wait after no messages arrive to forward batch of messages</description>
| <name>MaxBatchTime</name>
| <type>long</type>
| </attribute>
|
| <attribute access="read-write" getMethod="getSubName"
| setMethod="setSubName">
| <description>If consuming from a durable subscription, this is the name of the durable subscrition</description>
| <name>SubName</name>
| <type>java.lang.String</type>
| </attribute>
|
| <attribute access="read-write" getMethod="getClientID"
| setMethod="setClientID">
| <description>If consuming from a durable subscription, this is the client id to use</description>
| <name>ClientID</name>
| <type>java.lang.String</type>
| </attribute>
|
| <attribute access="read-write" getMethod="getFailureRetryInterval"
| setMethod="setFailureRetryInterval">
| <description>The amount of time to wait in milliseconds before retrying connection creation, after connection failure is detected, or -1 if no retries will be attempted</description>
| <name>FailureRetryInterval</name>
| <type>long</type>
| </attribute>
|
| <attribute access="read-write" getMethod="getMaxRetries"
| setMethod="setMaxRetries">
| <description>The maximum number of attempts to retry connection creation after connection failure is detected</description>
| <name>MaxRetries</name>
| <type>int</type>
| </attribute>
|
| <attribute access="read-only" getMethod="isFailed">
| <description>Has the bridge failed?</description>
| <name>Failed</name>
| <type>boolean</type>
| </attribute>
|
| <attribute access="read-only" getMethod="isPaused">
| <description>Is the bridge paused?</description>
| <name>Paused</name>
| <type>boolean</type>
| </attribute>
|
| <attribute access="read-only" getMethod="isStarted">
| <description>Is the bridge started?</description>
| <name>Started</name>
| <type>boolean</type>
| </attribute>
|
| <!-- Managed operations -->
|
| <operation>
| <description>JBoss Service lifecycle operation</description>
| <name>create</name>
| </operation>
|
| <operation>
| <description>JBoss Service lifecycle operation</description>
| <name>start</name>
| </operation>
|
| <operation>
| <description>JBoss Service lifecycle operation</description>
| <name>stop</name>
| </operation>
|
| <operation>
| <description>JBoss Service lifecycle operation</description>
| <name>destroy</name>
| </operation>
|
| <operation>
| <description>Pause the bridge</description>
| <name>pause</name>
| </operation>
|
| <operation>
| <description>Resume the bridge</description>
| <name>resume</name>
| </operation>
|
| </mbean>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4025855#4025855
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4025855
19Â years, 1Â month
[JBoss Portal] - Flex Login - 404
by johanwasserman
JBoss 4.0.5 GA
Tomcat 5.5
Portal 2.6.0 DR1
I successfully built a Flex login page, that works 100% when navigating to the page first (after login, it redirects to the portal and you're logged in), but when I navigate to the portal first, then click on the "Standard Login" on the User Portlet, I get 404 (The requested resource (/ware/login/login.jsp) is not available.)
Here is my config, am I missing something?
Flex app sitting in: C:\Zones\WebZone\Servers\Dev\jboss-4.0.5.GA.portal\server\default\deploy\jboss-portal.sar\portal-ware.war
portal-ware.war\WEB-INF\jboss-web.xml
<?xml version="1.0"?>
<jboss-web>
<display-name>Ware</display-name>
<app-name>ware</app-name>
<security-domain>java:/jaas/ware</security-domain>
<web-uri>portal-ware.war</web-uri>
<context-root>/ware</context-root>
</jboss-web>
portal-server.war\WEB-INF\web.xml
<!-- Provide secure access to unauthenticated users -->
<servlet-mapping>
<servlet-name>PortalServletWithPathMapping</servlet-name>
<url-pattern>/ware/*</url-pattern>
</servlet-mapping>
<!-- Force the mapping of the index.jsp -->
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<!--url-pattern>/login.jsp</url-pattern-->
<url-pattern>/ware/login/login.jsp</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>/error.jsp</url-pattern>
</servlet-mapping>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>JBoss Portal</realm-name>
<form-login-config>
<!--form-login-page>/login.jsp</form-login-page-->
<form-login-page>/ware/login/login.jsp</form-login-page>
<form-error-page>/error.jsp</form-error-page>
</form-login-config>
</login-config>
jboss-portal.sar\conf\login-config.xml
<application-policy name="ware">
<login-module code="org.apache.jackrabbit.core.security.SimpleLoginModule" flag="required"/>
</application-policy>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4025853#4025853
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4025853
19Â years, 1Â month