[EJB 3.0] - Re: Cannot join @OneToOne on non-PK fields?
by sisepago
# @JoinColumn(name="status", referencedColumnName="code")
-----
please read the jpa spec to understand how to use @JoinColumn: you can only use one of this attributes not both, because if you use both, name="status" is used as referenced key
# Lazy fetching has no problem, because I also use it:
@javax.persistence.Entity
| public class Customer implements java.io.Serializable{
| /** The serialVersionUID */
| private static final long serialVersionUID = 1L;
| private long id;
| private String lastName;
| private String firstName;
| private Address address;
|
| #1 can be used
| @javax.persistence.OneToOne(cascade={CascadeType.ALL}, fetch=FetchType.LAZY)
| @javax.persistence.JoinColumn(name="ADDRESSID")
|
| #2 can also be used
| @javax.persistence.OneToOne(cascade={CascadeType.ALL}, fetch=FetchType.LAZY)
| @javax.persistence.JoinColumn(referencedColumnName="ZIP")
| public Address getAddress() {return this.address;}
| public void setAddress(Address address){this.address = address;}
|
| }
|
|
and in my client class LEFT JOIN FETCH syntax to fetch customer with lazy address object
public List<Customer> getCustomersLazyUsing(long cId) {
| String query = "select c from Customer c " +
| "left join fetch c.address" +
| " where c.id = :cId ";
and all work perfect
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3985657#3985657
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3985657
19Â years, 7Â months
[JNDI/Naming/Network] - Re: JNDI Newbie - Please help !!!
by PeterJ
Which version of JBoss are you using?
Are you using the correct jbossall-client.jar that matches with the server?
I used 4.0.5, and here is my output:
Starting
| Key num: 4
| Keys: jnp.parsedName =
| Keys: java.naming.provider.url = localhost:1099
| Keys: java.naming.factory.initial = org.jnp.interfaces.NamingContextFactory
| Keys: java.naming.factory.url.pkgs = org.jboss.naming:org.jnp.interfaces
| Initial Context ok:
| Has More: true
| MyTxController: $Proxy72
| MyCustomer: $Proxy60
| TopicConnectionFactory: org.jboss.naming.LinkRefPair
| jmx: org.jnp.interfaces.NamingContext
| MyAccountController: $Proxy68
| HTTPXAConnectionFactory: org.jboss.mq.SpyXAConnectionFactory
| ConnectionFactory: org.jboss.mq.SpyConnectionFactory
| UserTransactionSessionFactory: $Proxy12
| HTTPConnectionFactory: org.jboss.mq.SpyConnectionFactory
| MyTx: $Proxy62
| XAConnectionFactory: org.jboss.mq.SpyXAConnectionFactory
| UserTransaction: org.jboss.tm.usertx.client.ClientUserTransaction
| UILXAConnectionFactory: javax.naming.LinkRef
| UIL2XAConnectionFactory: javax.naming.LinkRef
| MyNextId: $Proxy63
| MyAccount: $Proxy61
| queue: org.jnp.interfaces.NamingContext
| topic: org.jnp.interfaces.NamingContext
| bank-client: org.jnp.interfaces.NamingContext
| console: org.jnp.interfaces.NamingContext
| MyCustomerController: $Proxy70
| UIL2ConnectionFactory: javax.naming.LinkRef
| HiLoKeyGeneratorFactory: org.jboss.ejb.plugins.keygenerator.hilo.HiLoKeyGenerato
| rFactory
| UILConnectionFactory: javax.naming.LinkRef
| QueueConnectionFactory: org.jboss.naming.LinkRefPair
| UUIDKeyGeneratorFactory: org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGenerato
| rFactory
| RMIAdaptor ok: 522
| Name: jboss
| Name: org.jboss.mx.modelmbean.XMBean
| Finished
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3985652#3985652
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3985652
19Â years, 7Â months
[JBoss Seam] - Re: Parameter in EL in s:link problem
by virgo47
Thanks Gavin... addition to faces-config.xml helped. But I'm kinda confused now. My looks like this now:
| <?xml version='1.0' encoding='UTF-8'?>
| <!DOCTYPE faces-config PUBLIC
| "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
| "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
|
| <faces-config>
| <application>
| <view-handler>org.jboss.seam.ui.facelet.SeamFaceletViewHandler</view-handler>
| </application>
|
| <!-- A phase listener is needed by all Seam applications
| -->
| <lifecycle>
| <phase-listener>org.jboss.seam.jsf.SeamPhaseListener</phase-listener>
| </lifecycle>
| </faces-config>
|
And the one from booking demo looks like this:
| <?xml version="1.0" encoding="UTF-8"?>
| <!DOCTYPE faces-config
| PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
| "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
|
| <faces-config>
|
| <!-- Select one of the standard transaction models for the Seam application -->
|
| <lifecycle>
| <phase-listener>org.jboss.seam.jsf.SeamPhaseListener</phase-listener>
| </lifecycle>
|
| </faces-config>
|
Why you don't need that view-handler? I can't notice difference between JSF 1.0 or 1.1 in header (tried both). I had no view-handler there and it worked fine but when I started to experiment with it (after your post) it suddenly stopped to process JSF at all (browser offers download and it was raw JSF) - I can't reproduce that EL exception. ;-)
I'm glad it works now (and it even fixed my other problem), just little confused. I saw some JSF/EJB3 stuff before, but this all is overwhelming for me so far. ;-)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3985649#3985649
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3985649
19Â years, 7Â months