[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-994) seam-gen and mutiple foreign keys
by Niels Hoogeveen (JIRA)
seam-gen and mutiple foreign keys
---------------------------------
Key: JBSEAM-994
URL: http://jira.jboss.com/jira/browse/JBSEAM-994
Project: JBoss Seam
Issue Type: Bug
Components: Tools
Affects Versions: 1.2.0.GA
Environment: JBoss-4.0.5
Reporter: Niels Hoogeveen
I have generated a project with seam-gen based on generate-entities. All works fine, except for the generation of the home interfaces. In one of my tables I have two foreign keys to the same table. In the home interface two references are created to the appropriate object, but with the same name (which of course doesn't compile).
Here is a simplified example:
Table 1
Code:
CREATE TABLE test
(
id int4 NOT NULL DEFAULT nextval('test_id_seq'::regclass),
name varchar,
id_test2_1 int4,
id_test2_2 int4,
CONSTRAINT test_pkey PRIMARY KEY (id),
CONSTRAINT test_id_test2_1_fkey FOREIGN KEY (id_test2_1)
REFERENCES test2 (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT test_id_test2_2_fkey FOREIGN KEY (id_test2_2)
REFERENCES test2 (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
)
Table2
Code:
CREATE TABLE test2
(
id int4 NOT NULL DEFAULT nextval('test2_id_seq'::regclass),
name varchar,
CONSTRAINT test2_pkey PRIMARY KEY (id)
)
First Entity
Code:
@Entity
@Table(name = "test", schema = "public")
public class Test implements java.io.Serializable {
private int id;
private Test2 test2ByIdTest22;
private Test2 test2ByIdTest21;
private String name;
public Test() {
}
public Test(int id) {
this.id = id;
}
public Test(int id, Test2 test2ByIdTest22, Test2 test2ByIdTest21,
String name) {
this.id = id;
this.test2ByIdTest22 = test2ByIdTest22;
this.test2ByIdTest21 = test2ByIdTest21;
this.name = name;
}
@Id
@Column(name = "id", unique = true, nullable = false)
@NotNull
public int getId() {
return this.id;
}
public void setId(int id) {
this.id = id;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "id_test2_2")
public Test2 getTest2ByIdTest22() {
return this.test2ByIdTest22;
}
public void setTest2ByIdTest22(Test2 test2ByIdTest22) {
this.test2ByIdTest22 = test2ByIdTest22;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "id_test2_1")
public Test2 getTest2ByIdTest21() {
return this.test2ByIdTest21;
}
public void setTest2ByIdTest21(Test2 test2ByIdTest21) {
this.test2ByIdTest21 = test2ByIdTest21;
}
@Column(name = "name", length = 0)
@Length(max = 0)
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
}
second entity
Code:
@Entity
@Table(name = "test2", schema = "public")
public class Test2 implements java.io.Serializable {
private int id;
private String name;
private Set<Test> testsForIdTest21 = new HashSet<Test>(0);
private Set<Test> testsForIdTest22 = new HashSet<Test>(0);
public Test2() {
}
public Test2(int id) {
this.id = id;
}
public Test2(int id, String name, Set<Test> testsForIdTest21,
Set<Test> testsForIdTest22) {
this.id = id;
this.name = name;
this.testsForIdTest21 = testsForIdTest21;
this.testsForIdTest22 = testsForIdTest22;
}
@Id
@Column(name = "id", unique = true, nullable = false)
@NotNull
public int getId() {
return this.id;
}
public void setId(int id) {
this.id = id;
}
@Column(name = "name", length = 0)
@Length(max = 0)
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "test2ByIdTest21")
public Set<Test> getTestsForIdTest21() {
return this.testsForIdTest21;
}
public void setTestsForIdTest21(Set<Test> testsForIdTest21) {
this.testsForIdTest21 = testsForIdTest21;
}
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "test2ByIdTest22")
public Set<Test> getTestsForIdTest22() {
return this.testsForIdTest22;
}
public void setTestsForIdTest22(Set<Test> testsForIdTest22) {
this.testsForIdTest22 = testsForIdTest22;
}
}
Home interface of first entity. Here we have two Test2Home references, both with the name test2Home.
Code:
@Name("testHome")
public class TestHome extends EntityHome<Test> {
@In(create = true)
Test2Home test2Home;
@In(create = true)
Test2Home test2Home;
public void setTestId(Integer id) {
setId(id);
}
public Integer getTestId() {
return (Integer) getId();
}
@Override
protected Test createInstance() {
Test test = new Test();
return test;
}
public void wire() {
Test2 test2ByIdTest22 = test2Home.getDefinedInstance();
if (test2ByIdTest22 != null) {
getInstance().setTest2ByIdTest22(test2ByIdTest22);
}
Test2 test2ByIdTest21 = test2Home.getDefinedInstance();
if (test2ByIdTest21 != null) {
getInstance().setTest2ByIdTest21(test2ByIdTest21);
}
}
public boolean isWired() {
return true;
}
public Test getDefinedInstance() {
return isIdDefined() ? getInstance() : null;
}
}
BTW. I used the latest seam version from CVS.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 9 months
[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-2051) please put WEB-INF under view instead of resources (seam-gen)
by Dan Allen (JIRA)
please put WEB-INF under view instead of resources (seam-gen)
-------------------------------------------------------------
Key: JBSEAM-2051
URL: http://jira.jboss.com/jira/browse/JBSEAM-2051
Project: JBoss Seam
Issue Type: Feature Request
Components: Tools
Affects Versions: 2.0.0.CR1
Reporter: Dan Allen
Assigned To: Dan Allen
Fix For: 2.0.x
I am aware that there is no hotter issue than this one. But PAUSE before rejecting it and hear me out.
The current seam-gen project structure is
src
action
model
resources
WEB-INF
META-INF
view
IDEs choke on this structure, but it really comes down to just one folder. The src/ and resources/ directory really aren't a problem. The real problem is that WEB-INF/ just needs to be under view/. Seriously, if that can happen, the IDEs really will be happier. People are not arguing for the sake of arguing. This convention is the way that Sun laid out more than a decade ago and vendors have catered to it ever since (even JBoss). It's not like we woke up one day and said, gee, let's put WEB-INF/ in the folder with web artifacts. Rather than try to change the whole world, can we just move this one folder? I promise I am not arguing to read my own writing.
Proposed structure
src
action
model
resources
META-INF
view
WEB-INF
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 9 months
[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-1840) Serious nasty problem with ManagedEntityIdentityInterceptor
by Przemyslaw Jaskierski (JIRA)
Serious nasty problem with ManagedEntityIdentityInterceptor
-----------------------------------------------------------
Key: JBSEAM-1840
URL: http://jira.jboss.com/jira/browse/JBSEAM-1840
Project: JBoss Seam
Issue Type: Bug
Components: Core
Environment: pure Tomcat 6.0.13 + Hibernate 3.2.4, Seam-managed non-JTA Hibernate transactions, Seam.2.CVS.20.08.2007
Reporter: Przemyslaw Jaskierski
Priority: Critical
First of all, please do not underestimate problem in this report. It's a tough one, and definitely not a malfunction on my side. This disclaimer is because as a developer I know what a PR without a testcase is - but please bear with me. I've already spent ssooo much time on this issue that my co-workers will shoot my head off :(:(:(. I've tried to modify Seam examples to demonstrate it to you, but gave up due to problems with hibernate2 (not working Tomcat deployment), Booking (cannot log into it on AS) (BTW I understand that it's a BETA, just reporting)... It's 100% reproducible in my application, but I'm not allowed to share it :(:(:(.
I have a wizard-like, long-running conversation driven by a jpdl pageflow (flushMode=MANUAL). There is a couple of Conversation-scoped Seam components that backs this wizard. I have some @Entity and List<@Entity> fields (pure Hibernate Annotations, no JPA etc.) in some of them.
Problem is that ManagedEntityIdentityInterceptor overwrites valid values of these fields with NULL or ArrayList<NULL> values from time to time. It's quite discrete, and I manged to discover this behavior after a huge amount of time only because I've found this:
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=112335
and
http://jira.jboss.com/jira/browse/JBSEAM-1814.
Note that in my situation there is no DataModel-related stuff involved, access to these fields is driven by simple get/setters.
There is another strange thing. On Seam debug page I enter my conversation scope and list all pojos. There is, for example, "pojoName" and "pojoName.listName" components listed (I have only pojoName component registered with @Name, but looks like it's some kind of Seam optimization). As long as I enter/exit inspection of pojoName component, it's listName preserves its content as expected. But after clicking "pojoName.listName": 1st time it shows it's content, but after entering pojoName and pojoName.listName after this, this list is replaced by [null, null, null etc.] values. No, I don't do anything unusual there, it's a simple plain getter.
I think it's not only limited to view-accessed EL-resolved entities, because even my @In components get nullyfied fields (even during the same unit of work, when doing some complex cross-component processing in a single http request). Non-@Entity fields are left untouched.
After looking into ManagedEntityIdentityInterceptor code, I changed my fields to TRANSIENT (to be skipped by ignore(Field) method) and this made everything working OK, like expected. Of course having transient fields is not necessary what you want from you pojos, besides I think that it's a serious problem in ManagedEntityIdentityInterceptor that will ruin some nights of other developer if left unresolved.
I will gladly test eventual fixes against my codebase.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 9 months
[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-1918) Asyncronous methods called from an asyncronously executing methoed will not be invoke asyncronously
by Chris Rudd (JIRA)
Asyncronous methods called from an asyncronously executing methoed will not be invoke asyncronously
---------------------------------------------------------------------------------------------------
Key: JBSEAM-1918
URL: http://jira.jboss.com/jira/browse/JBSEAM-1918
Project: JBoss Seam
Issue Type: Bug
Components: Async
Affects Versions: 2.0.0.BETA1
Reporter: Chris Rudd
Currently the AsyncronousInterceptor triggers off of
Contexts.getEventContext().isSet(AbstractDispatcher.EXECUTING_ASYNCHRONOUS_CALL)
to determine if this invocation was from the asyncronous dispatcher. This works fine, except under the conditions where the asyncronously executed method calls another @asyncronous methd. In that case the Event context alreadt contains the AbstractDispatcher.EXECUTING_ASYNCHRONOUS_CALL marked and the execution is done immedialty instead of being scheduled.
I belive a simple resolution would be to have the AsyncronousInterceptor clear the AbstractDispatcher.EXECUTING_ASYNCHRONOUS_CALL before proceeding with the exection, but should only be done if the method in question is an @Asycnronous method. This would be to elimiate possible removal from other components that are called during the process of invoking the asyncronous method (ie injection, security, etc).
Here is me proposed change :
AsyncronousInterceptor.java line 24
@AroundInvoke
public Object aroundInvoke(InvocationContext invocation) throws Exception
{
boolean scheduleAsync = invocation.getMethod().isAnnotationPresent(Asynchronous.class) &&
!Contexts.getEventContext().isSet(AbstractDispatcher.EXECUTING_ASYNCHRONOUS_CALL);
if (scheduleAsync)
{
Dispatcher dispatcher = AbstractDispatcher.instance();
if (dispatcher==null)
{
throw new IllegalStateException("org.jboss.seam.async.dispatcher is not installed in components.xml");
}
Object timer = dispatcher.scheduleInvocation( invocation, getComponent() );
//if the method returns a Timer, return it to the client
return timer!=null && invocation.getMethod().getReturnType().isAssignableFrom( timer.getClass() ) ? timer : null;
}
+ else if( invocation.getMethod().isAnnotationPresent(Asynchronous.class) )
+ {
+ // Clear the async flag so that any async methods called by this invocation will execute asyncronously
+ Contexts.getEventContext().remove( AbstractDispatcher.EXECUTING_ASYNCHRONOUS_CALL );
+ return invocation.proceed();
+ }
else
{
return invocation.proceed();
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 9 months
[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-1590) Problem when deploying seam application as directory deployment in glassfish
by ivica c (JIRA)
Problem when deploying seam application as directory deployment in glassfish
----------------------------------------------------------------------------
Key: JBSEAM-1590
URL: http://jira.jboss.com/jira/browse/JBSEAM-1590
Project: JBoss Seam
Issue Type: Bug
Affects Versions: 2.0.0.BETA1
Environment: glassfish V2 build 53
seam 2.0.0 beta1
jdk 1.6.0 update1
netbeans 6 daily build
Reporter: ivica c
Fix For: 2.0.0.CR1
Problem occurs when deploying seam application as directory deployment in glassfish. I am getting this exception:
Exception occured in J2EEC Phasejava.lang.IllegalArgumentException: Invalid ejb jar [lib/jboss-seam.jar]: it contains zero ejb.
Note:
1. A valid ejb jar requires at least one session, entity (1.x/2.x style), or message driven bean.
2. EJB3+ entity beans (@Entity) are POJOs and please package them as library jar.
com.sun.enterprise.deployment.backend.IASDeploymentException: Error loading deployment descriptors for module [ctg-main] -- Invalid ejb jar [lib/jboss-seam.jar]: it contains zero ejb.
Note:
1. A valid ejb jar requires at least one session, entity (1.x/2.x style), or message driven bean.
2. EJB3+ entity beans (@Entity) are POJOs and please package them as library jar.
at com.sun.enterprise.deployment.backend.Deployer.loadDescriptors(Deployer.java:388)
at com.sun.enterprise.deployment.backend.AppDeployerBase.loadDescriptors(AppDeployerBase.java:358)
at com.sun.enterprise.deployment.backend.AppDeployer.deploy(AppDeployer.java:226)
at com.sun.enterprise.deployment.backend.AppDeployer.doRequestFinish(AppDeployer.java:148)
at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:191)
at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:108)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:905)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:279)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:774)
at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:187)
at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:223)
Caused by: java.lang.IllegalArgumentException: Invalid ejb jar [lib/jboss-seam.jar]: it contains zero ejb.
Note:
1. A valid ejb jar requires at least one session, entity (1.x/2.x style), or message driven bean.
2. EJB3+ entity beans (@Entity) are POJOs and please package them as library jar.
at com.sun.enterprise.deployment.util.EjbBundleValidator.accept(EjbBundleValidator.java:95)
at com.sun.enterprise.deployment.util.ApplicationValidator.accept(ApplicationValidator.java:82)
at com.sun.enterprise.deployment.EjbBundleDescriptor.visit(EjbBundleDescriptor.java:729)
at com.sun.enterprise.deployment.Application.visit(Application.java:1754)
at com.sun.enterprise.deployment.archivist.ApplicationArchivist.validate(ApplicationArchivist.java:470)
at com.sun.enterprise.deployment.archivist.ApplicationArchivist.openArchive(ApplicationArchivist.java:790)
at com.sun.enterprise.deployment.archivist.ApplicationArchivist.openArchive(ApplicationArchivist.java:744)
at com.sun.enterprise.deployment.backend.Deployer.loadDescriptors(Deployer.java:349)
... 10 more
but when I deploy as norma arhive(when upload it) everything works fine.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 10 months
[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-633) remoting extension in handling exceptions on client side
by Nico Gau (JIRA)
remoting extension in handling exceptions on client side
--------------------------------------------------------
Key: JBSEAM-633
URL: http://jira.jboss.com/jira/browse/JBSEAM-633
Project: JBoss Seam
Issue Type: Patch
Components: Remoting
Affects Versions: 1.1.0.GA
Reporter: Nico Gau
Priority: Optional
Hi all,
I don't really know what JIRA is by the way, so hopefully nobody is upset by this post. I first mailed Gavin but he told me I should put it in JIRA.
I currently work on a project which uses Seam Remoting directly and I didn't find a neat way in handling errors on the client side as Exceptions are not propagated to it. Therefore I changed Seam to transmit all exceptions which can be handled in the javascript part via another callback. E.g.:
Seam.Component.getInstance('userManager').currentUser(function(user) {
alert("user: " + user);
},
function(ex) {
alert("exception occured: " + ex.getMessage());
});
As the exception handler is optional, the change would not brake any client code. If you are interested in the change, you can reach me at heinzbeinz AT googlemail.com
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 11 months