[
https://jira.jboss.org/jira/browse/JBSEAM-3278?page=com.atlassian.jira.pl...
]
Dan Allen commented on JBSEAM-3278:
-----------------------------------
Thanks for the patch. Works great!
seam-gen generate-ui problem - entity in a different package
-------------------------------------------------------------
Key: JBSEAM-3278
URL:
https://jira.jboss.org/jira/browse/JBSEAM-3278
Project: Seam
Issue Type: Bug
Components: Tools
Reporter: Guido Simone
Fix For: 2.2.0.CR1
Here is an example:
The entity class PersonAddress has a ManyToOne relationship with Address which happens to
be in a different package. The seam generate-ui command will generate (among other
things) an EntityHome class named PersonAddressHome.
//==================================
// PersonAddress
package com.domain.model.person;
import com.domain.model.location.Address;
@Entity
public class PersonAddress
{
private Address address;
private PersonAddressTypeLookup addressTypeLookup;
private Person person;
@ManyToOne @NotNull
public Address getAddress() {return address;}
@ManyToOne @NotNull
public PersonAddressTypeLookup getAddressTypeLookup()
{ return addressTypeLookup; }
@ManyToOne @NotNull
public Person getPerson() {return person;}
// setters omitted
}
which generates:
//==================================
// PersonAddressHome
package com.domain.action;
import com.domain.model.person.*;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityHome;
@Name("personAddressHome")
public class PersonAddressHome extends EntityHome<PersonAddress>
{
// code omitted...
public void wire()
{
getInstance();
Address address = addressHome.getDefinedInstance();
if (address != null)
{
getInstance().setAddress(address);
}
PersonAddressTypeLookup addressTypeLookup = addressTypeLookupHome
.getDefinedInstance();
if (addressTypeLookup != null)
{
getInstance().setAddressTypeLookup(addressTypeLookup);
}
Person person = personHome.getDefinedInstance();
if (person != null)
{
getInstance().setPerson(person);
}
}
The generated code imports all entities in com.domain.model.person, but does not import
anything from com.domain.model.location so the compilation fails in the second line of the
wire() method (Address cannot be resolved to a type).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira