[jboss-user] [EJB 3.0] - Re: concurrently modifying entity instance

2008-04-17 Thread gsegura
You made me believe an actual advise was posted, anyway:

As reference says, the lock is honored at persistence-context level. Since two 
sessions are involved, there exists two different persistence-contexts, so 
EntityManager.lock() issued in one session has not enough 'reachability'.

Besides, the lock (either READ or WRITE) granted by EntityManager.lock() is not 
semantically equivalent to pessimistic lock. In other words no thread is 
getting blocked when accessing an already locked entity.

That is why I'm looking for expert advise.


View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4144748#4144748

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4144748
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [EJB 3.0] - Re: concurrently modifying entity instance

2008-04-17 Thread gsegura
No, it doesn't.   I'm aware of potential disadvantages of pessimistic locking,  
however that is needed here.  
So the question is how to implement pessimistic locking.

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4144940#4144940

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4144940
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [EJB 3.0] - concurrently modifying entity instance

2008-04-16 Thread gsegura
Dear all, 
I'm requesting in the kindest way any advise on this issue: concurrent 
modification of one entity instance.

The following is a simplified scenario, but describes the issue well. 
There is this entity which holds a number, one user is in charge of decreasing 
that magnitude and another one is in charge of incrementing it.

These two are the methods each user is supposed to invoke during interaction 
with the application.

In consumer's session:

public void decrement() {
  | Resource r = manager.find(Resource.class, id);
  | while(r.getCounter()0)
  | r.decreaseByOne() ;
  | }

In producer's session:

public void increment() {
  | Resource r = manager.find(Resource.class, id);
  | r.increaseCounterBy(100) ;
  | }


Those methods could potentially be invoked simultaneously, so one thing I'd 
like to prevent is method increment() been called during execution of 
decrement(), hence I need to either:
1.- serialize those invocations, or 
2.- pessimistically lock the entity instance.

For option 2, it is not clear to me how to lock the entity instance 'globally', 
since each user has his own persistence context entitymanager.lock() won't be 
enough, right?

For option 1 I don't even have a clue.


best regards,
Gerardo

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4144711#4144711

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4144711
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: demultiplexing notifications from MDB

2008-02-11 Thread gsegura
How is binded one SFSB with one user web session?
Is there any way to traverse the component tree ?

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4128511#4128511

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4128511
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: is remoting available in seam on tomcat?

2008-02-11 Thread gsegura
I'm sorry, the @WebRemote annotation was missing.

really appreciate your advice

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4128452#4128452

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4128452
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: demultiplexing notifications from MDB

2008-02-11 Thread gsegura
I'm aware the docs says:
anonymous wrote : Nor do they (Message-driven beans) have access to the session 
or conversation state of their caller
and found this old kind of feature request: 
http://www.jboss.com/index.html?module=bbop=viewtopict=80512

So very likely my intented approach is also a dead end.
I just would like some confirmation on this.

So instead I'll try to implement this feature with an application scoped bean, 
who holds a mapping of user to events.


View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4128551#4128551

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4128551
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: Longrunning process

2008-02-11 Thread gsegura
hispeedsurfer:
do you mind explaining more details please? was a refactorization the solution?

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4128549#4128549

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4128549
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: serializing access to resource

2008-02-10 Thread gsegura
Ok, perhaps the correct question is:

Does EJB3 persistence honors this aspects of Entity Bean Life Cycle (these 
behaviour is described in 
http://www.ubookcase.com/book/Sams/JBoss.4.0.The.Official.Guide/0672326485/ch05lev1sec4.html):

anonymous wrote : With the default configuration of JBoss there is only one 
active instance of a given entity bean in memory at one time

and the locking policy defined in each container configuration in 
standardjboss.xml:

locking-policyorg.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock/locking-policy


I think if this two pieces are honored, then all I have to assure is the proper 
container-configuration (Standard CMP 2.x EntityBean) is in effect on my entity 
bean, what do you think??

please keep in mind by any means I'm not suggesting any disrespect via 
disinformation. I'm just kindly asking for some insight about this pessimistic 
locking issue, which at some point one self have to face.

regards,


PS: The reason I formulate the question as that is because the book Pro EJB3 
JPA says the JPA doesn't support a portable way to do pessimistic locking.




View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4128156#4128156

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4128156
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: EntityManager not injected in onMessage method

2008-02-10 Thread gsegura
Maybe this could this be associated with the lifecycle of the MDB being 
dependent on seam:

http://www.jboss.org/?module=bbop=viewtopict=100946


I'll appreciate if you post back if this is the case, because I'm also about to 
implement a configuration similiar to yours.


View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4128254#4128254

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4128254
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - demultiplexing notifications from MDB

2008-02-10 Thread gsegura
Hello, 
I have this seam application that uses a message driven bean for receiving 
messages from external system.
Upon arrival of message I would like to notify the specific client (provided 
she/he has an ongoing web session) by means of a4j:push listener.

The question is: 
how do I access a particular SFSB instance bounded to the related user? that 
is, the bean to whom the a4j:push listener is bound to??


(I hope my english is good enough to correctly describe the question)

regards,
Gerardo

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4128251#4128251

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4128251
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: serializing access to resource

2008-02-08 Thread gsegura
The problem is I don't use hibernate directly but through JPA, besides the 
hibernate's documentation says:
anonymous wrote : Hibernate will always use the locking mechanism of the 
database, never lock objects in memory!

But can't find description of behaviour when some thread tries to access an 
already locked row. It willl be blocked? an exception thrown?

Do you think is it possible to achieve this at the object level? by means of 
locking the entity bean itself? 

It would be great to do this via some stablished and robust api, the previously 
cited documentation (Jboss 4.0 official guide) mentions something about it, but 
not in a useful hands-on way (at least to my taste).

Otherwise, is the only option left to implement this ?
http://www.martinfowler.com/eaaCatalog/pessimisticOfflineLock.html


best regards

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4127981#4127981

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4127981
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - serializing access to resource

2008-02-07 Thread gsegura
Hello,
I need to access an entity bean instance in a serial fashion, so I kindly 
request for any pattern to implement this.

The use case is similar to managing an account balance, the account must be 
blocked during modification. I need to block other requests until the resource 
is available (as if it was a printer).  That is why optimistic locking is not 
suitable.

I don't think synchronizing the SFSB which handles the entity bean is the best 
way since that would serialize invocation regardless of the entity bean 
instance been updated, I only  want to avoid concurrently modifying the same 
entity bean instance.

Jboss 4.0 official guide describes the transaction lock behaviour which: 
anonymous wrote : ensures that only one transaction at a time has access to a 
given entity bean

But it is not clear to me how this apply in the case, for example, of two 
entitymanagers loading same entity bean. Does it mean the second one's thread 
will be locked at that precise moment?

Also I don't quite grasp the behavior of entitymanager.lock(), what happens 
when another thread tries to lock one entity bean instance already locked? the 
locking effect is global to different entitymanager instances?

I deeply appreciate any advice

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4127665#4127665

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4127665
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - is remoting available in seam on tomcat?

2008-01-27 Thread gsegura
Hello 

I'm getting a HTTP 404 error on 
http://localhost/myapp/seam/resource/remoting/resource/remote.js
  | 
  | also in 
  | 
  | http://localhost/myapp/seam/resource/remoting/interface.js?mycomponent  
  | 

Since everything else seems in place (I have the 
org.jboss.seam.servlet.SeamResourceServlet servlet properly configured in 
web.xml) I wonder if the interface necessarily has to be annotated as @Local?

I do not include the annotation because this application uses seam on tomcat, 
with no EJB.
regards

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4123826#4123826

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4123826
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: Several actions performed by one bean - is it possible a

2008-01-27 Thread gsegura
Hi, there isn't such restriction to have just one method with @Begin, probably 
there is something else wrong with your code.
regards,

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4123883#4123883

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4123883
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - weird navigation error

2008-01-24 Thread gsegura
Hello, I've deployed an application in two machines running windows + tomcat 
5.5 and/or tomcat 6.0,  everything goes ok.

but that same application has this weird navigation problem when deployed in 
linux  + tomcat 5.5 and/or tomcat 6.0:

in login page (which is default page) after entering correct login and password 
and clicking login button the same login.seam page keeps appearing even though 
the authentication was successful.

Even more, the welcome message which I inject after successful identification 
appears when login page is rendered again.
The logs show no error, only a bunch of debug messages I'm 

I don't know why!  same code runs ok in those other windows machines :(
Is there a way to check why the incorrect page is been rendered??  

Given that the authentication is successful  I wonder maybe that server is 
filtering some cookie information or something which prevents the session been. 
 How could I check for this condition?

is there a way to dump debug info from navigation logic to see why the login 
page is re-displayed??

one thing I noted is that in my machine the login form tag includes the session 
id:

form id=login name=login method=post 
action=/eco1/login.seam;jsessionid=7C53A3E06BBFBFC72AA09363038D8644  
enctype=application/x-www-form-urlencoded

but in linux deployment it doesn't includes jsessionid:

  | form id=login name=login method=post action=/eco1/login.seam 
enctype=application/x-www-form-urlencoded
  | 

Actually I see I'm not always hitting the server, the login page redisplays but 
logs are not actualized. But I didn't noticed before because the welcome user 
___! keeps varying as I enter different login names.
(Does this even makes sense???) I swear the message changes.
This happens with either IE or Firefox,  at some point I'm hitting some cache, 
sometimes not even if I restart the browser the log changes.



please I would really appreciate some insight on this issue, which is probably 
not related.

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4123299#4123299

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4123299
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: One Seam component calling another

2007-12-31 Thread gsegura
Hi, 
it could be just the different variable name:

private EntityManager em;
and
private EntityManager entityManager;

regards

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4116210#4116210

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4116210
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: how to dis-manage entities?

2007-12-18 Thread gsegura
Probably I'm missing some fundamental knowledge about this issue, I do not 
think this scenario is that uncommon: 

how to retrieve an entity by query (or otherwise) in 'read-only mode' that is, 
avoid updating it at flush time?

Given that it is been managed by EntityManager, it will be implicitly updated 
(that is, even without calling EntityManager.merge explicitly), right? 

Or could be that, in general, I am using the wrong approach/asking the wrong 
question?

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4113669#4113669

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4113669
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - safe way to test if entity is persisted

2007-12-18 Thread gsegura
Hello,
in this topic http://www.jboss.com/index.html?module=bbop=viewtopict=98478 
the question of what is the proper (specification compliant) way to check if an 
entity has been persisted was raised.

And here http://opensource.atlassian.com/projects/hibernate/browse/HHH-2439 is 
stated that anonymous wrote : checking non-null identifier value being 
available on an entity instance if its in persistent state
is at least anonymous wrote : relying on questionable behavior

but I didn't see any alternative approach suggested, so I'm asking for the safe 
 way to verify persistent state of an entity.

regards

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4114022#4114022

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4114022
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: missing conversation entry error

2007-12-17 Thread gsegura
I'm sorry, pretending to make the code clearer I removed a rich:modalPanel used 
for confirmation, and it turns out there was actually the error.

as I posted before, the link was rendered by:
s:div rendered=#{editorEmployee.employee.id!=null}
  |   h:commandLink id=btnEliminar value=delete 
action=#{editorEmployee.delete}/
  | /s:div
  | 

and the javascript code used to activate the link was:

  | function doDelete() {
  | window.location = document.getElementById('f:btnEliminar').href ;
  | }


I couldn't found a way to trigger the link programmatically, directly assigning 
window.location apparently has not the same effect.

By time constraints to get around of my lack of knowledge of that js api I 
inserted a confirmation page instead.  

Would be nice to know the correct way to use a rich:modalPanel to ask for 
confirmation, and then invoke h:commandLink, though.

anyway really thanks for your time




View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4113632#4113632

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4113632
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: how to invoke action, then display resource

2007-12-17 Thread gsegura
Just what I needed,

thank you!


View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4113634#4113634

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4113634
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: how to dis-manage entities?

2007-12-13 Thread gsegura
perhaps the topic name was not the best, but I think its a fair question. 
So far, only strategy to avoid the entity which holds the collection to get 
updated is to resort to deal with id alone, a not very object-oriented way to 
go, so instead of retrieving the ticket.course object fetch just the id:
Integer idCourse = (Integer)entityManager
  | .createQuery(select t.course.id from Ticket t where 
t.code=#{register.code})
  | .getSingleResult();


But I don't know if dealing with IDs is the proper way to go with respect to 
ORM techniques.

At the same time this makes think of another issue: the implementation of 
master-detail editions, which at first, for the neophyte like me, feels natural 
to handle using nested conversations and sharing full objects but the preferred 
way to go is using entityhome and its passing-just-the-id technique, again a 
not very OO-ish way IMHO.



View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4112762#4112762

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4112762
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: pattern to form urls for resources requested

2007-12-12 Thread gsegura
thanks for the follow up Pete!

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4112376#4112376

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4112376
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: question about components and persistence

2007-12-12 Thread gsegura
Thanks for you answer, although I don't see a hit to database at the beginning 
of every conversation much extra load I would like to know more about why 
keeping just the Id is better. 
At first it would seem to the neophyte like me a more natural way to keep the 
object itself and perhaps merge it at the beginning of each conversation.
(issue aside I wonder if there is a way to differentiate between a managed 
entity and one that is not, to avoid the exception thrown when trying to merge 
an already managed entity)

Rephrasing, when is more appropriate to merge and entity instead of reloading 
it?  
I apologize if this question is not entirely related to seam

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4112379#4112379

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4112379
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: Adding custom timeout action

2007-12-12 Thread gsegura
Assuming session contexts variables are removed when session expires
perhaps this could work:

 
  | @Observer(org.jboss.seam.preDestroy.sessionScopedVariable)
  | public void cleanup() {}
  | 
or org.jboss.seam.preDestroyContext.

what do you think?


View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4112389#4112389

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4112389
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: persist() / remove() at end of long running conversation

2007-12-12 Thread gsegura
Is there a final consensus about this issue?  
I mean how is done know and if this should change in future version (which one) 
?
to be in the safe side: what would be the best way to test for 'persistency' of 
an entity?
also I kept the idea this is not an issue that is RDBM related, right? 
I really appreciate you sharing about this interesting stuff

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4112435#4112435

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4112435
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - how to exclude entities in flush

2007-12-12 Thread gsegura
Hello, I got into this kind of chicken-egg problem related to entity 
versioning: 

There is an entity Course which has a collection of CourseNote.
When adding a CourseNote to the collection I have to obtain a managed instance 
of Course, whose version field is been incremented implicitly when the flush 
occurs (because it is been managed).

And that is the problem because when more than one user are inserting 
CourseNotes to the collection, the second one will get an 
optimisticlockexception at the time he tries to merge his instance of the course

I do need to access the course during CourseNote creation to do some work (so 
entityManager.getReference is not enough) but  that very action is causing the 
course to get managed and involved in the transaction, which I do not want to 
happen.


//validation omited
  | Ticket ticket = (Ticket)entityManager
  | .createQuery(select t from Ticket t where t.code=#{register.code})
  | .getSingleResult(); 
  | 
  | CourseNote courseNote = ticket.getCourse().enroll(user) ;
  | entityManager.persist(courseNote) ;
  | 
  | //...
  | entityManager.flush() ; 
  | 
  | 


class Course {
  | public void enroll(User user) {
  | CourseNote cn = new CourseNote(user,this) ;
  | if(!getCourseNotes().contains(c)) {
  | getCourseNotes().add(c) ;
  | usuario.getCourseNotes().add(c) ;
  | return c ;
  | }
  | throw new IllegalStateException(
  | new StringBuilder(50)
  | .append(User )
  | .append(user.getId())
  | .append( is already enrolled in the course )
  | .append(this.getId()).toString()) ;
  | }
  | }
  | 


Please, some advice on this will be very very appreciated 


View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4112447#4112447

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4112447
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - how to dis-manage entities?

2007-12-12 Thread gsegura
Hello, I got into this kind of chicken-egg problem related to entity 
versioning: 

There is an entity Course which has a collection of CourseNote.
When adding a CourseNote to the collection I have to obtain a managed instance 
of Course, whose version field is been incremented implicitly when the flush 
occurs (because it is been managed).

And that is the problem because when more than one user are inserting 
CourseNotes to the collection, the second one will get an 
optimisticlockexception at the time he tries to merge his instance of the course

I do need to access the course during CourseNote creation to do some work (so 
entityManager.getReference is not enough) but  that very action is causing the 
course to get managed and involved in the transaction, which I do not want to 
happen.


//validation omited
  | Ticket ticket = (Ticket)entityManager
  | .createQuery(select t from Ticket t where t.code=#{register.code})
  | .getSingleResult(); 
  | 
  | CourseNote courseNote = ticket.getCourse().enroll(user) ;
  | entityManager.persist(courseNote) ;
  | 
  | //...
  | entityManager.flush() ; 
  | 
  | 


class Course {
  | public void enroll(User user) {
  | CourseNote cn = new CourseNote(user,this) ;
  | if(!getCourseNotes().contains(c)) {
  | getCourseNotes().add(c) ;
  | usuario.getCourseNotes().add(c) ;
  | return c ;
  | }
  | throw new IllegalStateException(
  | new StringBuilder(50)
  | .append(User )
  | .append(user.getId())
  | .append( is already enrolled in the course )
  | .append(this.getId()).toString()) ;
  | }
  | }
  | 

I kindly request some pattern or tip.
Please, some advice on this will be very very appreciated

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4112449#4112449

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4112449
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - how to invoke action, then display resource

2007-12-09 Thread gsegura
Hi, I want to show a page with an excel file after clicking some button.
But don't know how to redirect  to show the file, I tried using pages.xml as 
any other page but didn't worked:


s:link view=/reports/status_report.xls value=Export target=_blank /
  | 

!-- This don't work,  what would be the correct way to acomplish this?--
  | 
  | page view-id=/reports/status_report.xls 
action=#{reporter.doStatusReport}/

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4111484#4111484

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4111484
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - missing conversation entry error

2007-12-09 Thread gsegura
Hello 
I'm having problems with a nested conversation, which after termination cannot 
restore the parent conversation only in 1 out of 3 similar (it seems so) cases.

Its a case of edition of item A which has a collection of items B, when edition 
of item A starts I begin a conversation, 
inside that page every edition of items B is done inside a nested conversation.
It works fine except in case of deletion of item B, which throws 
IllegalStateException: missing conversation entry. 
Here is the relevant code

this is the extract from master page (company which holds a collection of 
employees):
!--  page for edition of Company --
  | s:link value=Add employee action=#{editorEmployee.create} 
rendered=#{editorCompany.company.id!=null}/
  | 
  | rich:dataTable value=#{editorCompany.company.employees} var=emp 
rows=5 rendered=#{editorCompany.company.employees.size0}
  |  h:column
  |   h:outputText value=#{emp.name} /
  |   br/
  |   s:link value=Edit action=#{editorEmployee.select(emp)}  /
  |  /h:column
  | /rich:dataTable
  | 

this is the extract from detail page (employee data):

  | h:form id=f
  | 
  | s:div rendered=#{editorEmployee.employee.id!=null}
  | h:commandLink id=btnEliminar value= 
action=#{editorEmployee.delete}/
  | /s:div
  | 
  | s:decorate id=nameDecorate template=/layout/edit.xhtml
  | ui:define name=labelName:/ui:define
  | h:inputText id=name value=#{editorEmployee.employee.name} 
required=true
  | a4j:support event=onblur reRender=nameDecorate/
  | /h:inputText
  | /s:decorate
  | 
  | div class=buttonBox
  | h:commandLink action=#{editorEmployee.save}
  | h:graphicImage value=/img/btn/btn_save.gif 
alt=save styleClass=btn  /
  | /h:commandLink
  |   
  | h:commandLink action=#{editorEmployee.cancel} 
immediate=true
  | h:graphicImage value=/img/btn/btn_cancel.gif 
alt=cancel styleClass=btn  /
  | /h:commandLink
  | /div
  | /h:form
  | 

the pages.xml:

  | page view-id=/admin/editorEmployee.xhtml
  | navigation from-action=#{editorEmployee.save}
  | rule if=#{editorEmployee.ok}
  | redirect view-id=/admin/editorCompany.xhtml/
  | /rule
  | rule if=#{not editorEmployee.ok}
  | redirect view-id=/admin/editorEmployee.xhtml/
  | /rule
  | /navigation
  | navigation from-action=#{editorEmployee.cancel} 
  | redirect view-id=/admin/editorCompany.xhtml/
  | /navigation
  | navigation from-action=#{editorEmployee.delete}
  | redirect view-id=/admin/editorCompany.xhtml/
  | /navigation
  | /page
  | 


finally, the EditorEmployee.java

  | @Scope(ScopeType.CONVERSATION)
  | @Name(editorEmployee)
  | @Restrict(#{identity.loggedIn and s:hasRole('Administrator')})
  | public class EditorEmployeeAction {
  | @In(#{editorSede.sede})
  | Company company ;
  | 
  | @Begin(nested=true, flushMode=FlushModeType.MANUAL)
  | public void select(Employee selectedEmployee) {
  | log.info(selectEmployee, beginning 
conversation.id=#0,Conversation.instance().getId()) ;
  | employee = entityManager.merge(selectedEmployee);
  | }
  | 
  | @Begin(nested=true, flushMode=FlushModeType.MANUAL)
  | public void crear() {
  | log.info(newEmployee, beginning 
conversation.id=#0,Conversation.instance().getId()) ;
  | employee = new Employee(company, ) ;
  | }
  | 
  | @End
  | public void delete() {
  | company.getEmployees().remove(employee) ;
  | entityManager.remove(employee) ;
  | entityManager.flush() ;
  | log.info(deleted employee #0, conversation.id: 
#1,employee,Conversation.instance().getId()) ;
  | facesMessages.add(Employee deleted successfully.) ;
  | }
  | 
  | public void save() {
  | boolean valid = validateEmployee(employee) ;
  | ok = false ;
  | if(valid) {
  | //agregate to collection only if new employee
  | if(employee.getId()==null)  
  | company.getEmployees().add(employee) ;
  | 
  | entityManager.persist(employee);
  | facesMessages.add(Employee data saved ok);
  | ok = true;
  | entityManager.flush() ;
  | 
  | log.info(finishing nested conversation 
#0,Conversation.instance().getId());
  | //conversation ended programmatically because in case 
validation fails the page is redisplayed
  |   

[jboss-user] [JBoss Seam] - help with this entity been updated implicitly

2007-12-06 Thread gsegura
Hello everybody, 
I have this use case: an item is selected from a list, the edit page for that 
item is shown, if the save action is invoked some validation is done inside 
that same method, only if everything is ok I call persist, otherwise the same 
edit page is redisplayed. 

Everything goes fine except one thing: even if validation fails (so I don't 
call persist)  the entity is been updated, why? how? where?  I reproduce some 
code:

@Scope(ScopeType.CONVERSATION)
  | @Name(courseEditor)
  | @Restrict(#{identity.loggedIn and s:hasRole('Administrator')})
  | public class CourseEditorAction {
  | 
  | @Begin(nested=true)
  | public void select(Course selectedCourse) {
  | course = entityManager.merge(selectedCourse);
  | }
  | 
  | public void save() {
  | if(course.getStartDate()!=null  course.getFinishDate()!=null 
  | course.getStartDate().compareTo(course.getFinishDate())=0) 
{
  | facesMessages.addToControl(finishDate,must be posterior to 
start date) ;
  | ok = false ;
  | }
  | else {
  | sede = entityManager.merge(sede) ;
  | if(course.getId()==null)
  | //my way to update parent collection of courses 
(only if course is new) 
  | sede.getCourses().add(course) ; 
  | entityManager.persist(course);
  | facesMessages.add(Course saved successfully);
  | //I only finish conversation in case the edition use 
case finish
  | Conversation.instance().end() ;
  | ok = true;
  | }
  | }
  | 
  | @End
  | public void cancel() {}
  | 
  | public boolean isOk() {
  | return ok ;
  | }
  | }

page view-id=/admin/courseEditor.xhtml
  | navigation from-action=#{courseEditor.save}
  | rule if=#{courseEditor.ok}
  | redirect view-id=/admin/sedeEditor.xhtml/
  | /rule
  | rule if=#{not courseEditor.ok}
  | redirect view-id=/admin/courseEditor.xhtml/
  | /rule
  | /navigation
  | navigation from-action=#{courseEditor.cancel}
  | redirect view-id=/admin/sedeEditor.xhtml/
  | /navigation
  | 
  | /page

if finish date value is before start date, the page is redisplayed, the message 
describing the incorrect input is shown, but at that moment the course already 
has been updated :S

I though maybe select method was been called every time the page is redisplayed 
and since there is a merge that was causing the update, but no:  select method 
is called (makes sense) only first time. 
so the updating is invoked somewhere else...  
any help is much appreciated

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4110994#4110994

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4110994
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: @End commits entity changes!

2007-12-06 Thread gsegura
I think this is related to the flush mode of the conversation,  look for 
@Begin(flushMode=FlushModeType.MANUAL),
I think that normally when conversation ends  everything is flushed 
autommatically.

I just posted a somewhat related question but there the conversation is not 
finished and yet I'm having an update, ok, no more crossposting :P

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4110995#4110995

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4110995
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: help with this entity been updated implicitly

2007-12-06 Thread gsegura
it wasn't enough to not end the conversation, I must set manual flush mode to 
avoid the updating when method ends  and call entityManager.flush() when I want 
data to be saved.


View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4111057#4111057

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4111057
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: help with this entity been updated implicitly

2007-12-06 Thread gsegura
ashamed to admit, another case of RTFM

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4111058#4111058

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4111058
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: Why control IDs in validation messages?

2007-12-06 Thread gsegura
I experienced this too,  I started from jpa example. At first the message 
displayed correct (with no Id).

Although it doesn't seems related (and I didn't have time find out exactly the 
reason)   I think it was about messing around with the default language and not 
including the proper messages_XX.properties in WEB-INF/classes.

After correcting that error in my ant script I noticed the ids in the messages 
were gone, but again, didn't have a chance to confirm if that was in fact the 
reason.  I suspected of that because other related things remained equal.

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4111059#4111059

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4111059
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - question about components and persistence

2007-12-03 Thread gsegura
Hello, I'm having problems to get same during method invocation, I mean:
there is the class User which has a collection of items.
- One instance of user is maintained during session, 
- then there is this action method which adds an item to the user's collection
- there is also another method which ask question about items in the users 
collection,
 
the problem is that the user instance is not the same in those methods, so the 
collection has not the same data. I've tried using merge at the beginning of 
those methods but an OptimisticLockException is thrown. here is my code so far:
@Scope(ScopeType.CONVERSATION)
  | @Name(exam)
  | @Restrict(#{identity.loggedIn})
  | public class ExamAction implements Evaluacion {
  | //injected from user in session
  | @In(required = true)
  | @Out
  | private User user;
  | 
  | 
  | @End
  | public void calificate() {
  | //... calculate calification, then:
  | Calification cal = user.setCalificacion(course, points) ;
  | 
  | Calification mergedcal = entityManager.merge(cal) ;
  | entityManager.persist(cal) ;
  | }
  | 
  | public boolean isExamDone() {
  | // this throws OptimisticLockException, casued by 
StaleObjectStateException
  | //but without this the user (hashcode) is different than the 
one injected in method calificate
  | //so I'm confused :S
  | 
  | User mergedUser = entityManager.merge(user) ;
  | Calification cal = mergedUser.findCalificacion(course) ;
  | return cal.getCalificacionEvaluacion()!=null ;
  | }
  | }
  | 
@Entity
  | @Table(name = user, catalog = test1)
  | public class User implements java.io.Serializable {
  | 
  | @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy 
= user)
  | public SetCalification getCalificacions() {
  | return this.calificacions;
  | }
  | 
  | public void setCalificacions(SetCalification calificacions) {
  | this.calificacions = calificacions;
  | }
  | 
  | public Calification findCalificacion(Course course) {
  | for(Calification c : getCalificacions())
  | if(c.getId().getIdCourse()==course.getId())
  | return c ;
  | throw new NoSuchElementException(
  | new StringBuilder(52)
  | .append(course )
  | .append(course.getId())
  | .append(, not found for user )
  | .append(getId()).toString()) ;
  | }
  | 
  | public Calification setCalificacion(Course course, int points) {
  | Calification c = null ;
  | try {
  | c = findCalificacion(course) ;
  | } catch(NoSuchElementException e) {
  | c = new Calification(this, course, 0) ;
  | getCalificacions().add(c) ;
  | }
  | 
  | c.setPoints(points) ;
  | return c ;
  | }
  | }

so the question is, how can I modify the user's collection of items and access 
same collection every time (I tried outjecting user but no effect) or how can I 
synchronize those objects before using them?
please, I really appreciate some advice here
regards

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4109964#4109964

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4109964
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: question about components and persistence

2007-12-03 Thread gsegura
I could, of course, load the user and collection from database every time, but 
I don't think this is the best way

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4109965#4109965

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4109965
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: question about components and persistence

2007-12-03 Thread gsegura
I think I've found the precise answer in last reply of 
http://www.jboss.com/index.html?module=bbop=viewtopict=103356

the @Out scope doesn't rely on the scope of @In, it must declared individually:
@Out(scope=ScopeType.SESSION)  
that's why I wasn't reaching same instance between calls

great forum!

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4109974#4109974

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4109974
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - pattern to form urls for resources requested

2007-11-28 Thread gsegura
Hello, 
I've read using absolute paths for reaching views is the recommended way, 
however given that webapp context path is variable some folks have resorted to 
this technique to resolve contextpath:
http://www.jboss.com/index.html?module=bbop=viewtopict=120560

But what about URLs to resources defined inside .css files? EL expressions 
won't be evaluated there, right?. Should I stick to static references to 
ContextPath? 

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4108746#4108746

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4108746
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - question about programmatically accessing seam component

2007-11-22 Thread gsegura
Hello, 
I'm in the need of programmatically accessing (I mean not using @In annotation) 
a component which is created with @Factory . But neither this:

  | Course course = (Course)Contexts.lookupInStatefulContexts(course) ;
  | 
nor this, is working:
Course course=(Course)Contexts.getSessionContext().get(course) ;
Both methods return null, as if the factory method is not been called. Is this 
correct behavior or could it be something in my code, I reproduce here the 
related parts.
By the way I'm not able to inject the component because its factory method is 
declared inside a component with @Restrict(#{identity.loggedIn}) declared, 
but I'm trying to use it when no login has happened yet. But just before I plan 
to use the login ocurrs, so at that time the @Restrict should not be a problem. 
If I try to use @In the injection tries to occur to early.

I think I better wrote the code:

firstly the component with the declared factory

  | @Name(courseManager)
  | @Scope(ScopeType.SESSION)
  | @Restrict(#{identity.loggedIn})
  | public class CourseManagerAction implements CourseManager {
  | 
  | @Factory
  | public Course getCourse() {
  | // gets default single course
  | Course course = (Course) entityManager
  | .createQuery(select c from Course c).getSingleResult();
  | return course;
  | }
  | }
  | 

then the case where I want to use the course component:

  | @Scope(ScopeType.EVENT)
  | @Name(register)
  | public class RegisterAction implements Register {
  | 
  |   public void register() {
  | //here the user register itself 
  | //after that do auto-login
  | identity.authenticate() ;
  | 
  |  //now I want to access the course
  |  Course course = 
(Course)Contexts.getSessionContext().get(course) ;
  | 
  |  //but course is null 
  |  //why? shouldn't this call be similar to: @In Course course ??
  |   }
  | }
  | 

any comments?

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4107020#4107020

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4107020
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: question about programmatically accessing seam component

2007-11-22 Thread gsegura
Indeed, it works
thanks!

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4107213#4107213

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4107213
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - html element id appearing on validation message

2007-11-22 Thread gsegura
Perhaps this is simple but I can not find how to stop the html element id from 
appearing in the validation message each time the validation ocurrs, that is, I 
have a template like this (taken from some seam example):

  |   div class=prop
  | s:label styleClass=name #{invalid?'errors':''}
  | ui:insert name=label /
  | s:span styleClass=required rendered=#{required}*/s:span
  | /s:label
  | span class=value #{invalid?'errors':''}
  | s:validateAll
  | ui:insert /
  | /s:validateAll
  | /span
  | s:message styleClass=error errors/
  | /div
  | 
which I use as:

  | s:decorate id=decorateAddress template=/layout/edit.xhtml
  |  ui:define name=labelAddress:/ui:define
  |  h:inputText id=address value=#{register.info.address} 
required=true 
  |   a4j:support event=onblur reRender=decorateAddress/
  |  /h:inputText
  | /s:decorate
  | 

when the validation message appears next to the control it always includes the 
html element id, something like this:


  | registerForm:decorateAddress:address: Validation error: required value
  | 
 
But I would like NOT to show the registerForm:decorateAddress:address part in 
the validation message, how to do so? 
thanks in advance for any help

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4107217#4107217

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4107217
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: how to declare Entity property not mapped to DB

2007-11-08 Thread gsegura
I got it:  @Transient! :)

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4102872#4102872

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4102872
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - how to declare Entity property not mapped to DB

2007-11-08 Thread gsegura
Hello, 
I would like to declare a new property in some entity,  which should not be 
mapped to the database (this property holds temporal data), I search for 
something like @Volatile but no luck.

I'll deeply appreciate any help,
regards

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4102869#4102869

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4102869
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - dinamically creating form elements

2007-10-29 Thread gsegura
Hello, Could someone give me advise on this, please:
Is it possible to dinamically append new controls (textarea, checkbox, 
radiobutton)  to a form during user interaction?
I mean, those newly created elements don't have yet a backing bean in server 
side, is there a way to create a dynamic bean or equivalent?
regards


View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4100028#4100028

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4100028
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: hidden exception issue?

2007-02-16 Thread gsegura
baz: I did that when I first encounter the problem and found start method was 
called just once.
 
I also asigned some values to the properties of newUser inside tehe start 
method, like:
newUser.setName(testing) ;
and that didn't throw the referred exception.

The exception was been thrown by having a reference to the newUser object, for 
instance:
h:inputText value=#{newUser.name} required=true /

I compared once and again the code with seamspace (you can see it is practicaly 
the same) but could find my mistake. Of course, seamspace works fine in my 
machine. Almost only difference is the entity User/Member class.




View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4017479#4017479

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4017479
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: Seam Gen Problem

2007-02-16 Thread gsegura
To find out where is looking for the jar driver try using filemon by 
sysinternals (I hope I'm not offending any rule by talking about third party 
product, it's free though)

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4017482#4017482

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4017482
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: hidden exception issue?

2007-02-15 Thread gsegura
Nop, I have client side state saving specified. 

I worked around the problem by not using the factory method and exposing 
newUser as a property of the bean and it worked. 

By doing so I'm not explicitly creating a conversation and I know if there is 
an error somewhere in the code it will bite me again, but for now I'm good.

I just wonder which other (besides  client side state saving) causes of error 
might I had.

regards,

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4017430#4017430

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4017430
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - hidden exception issue?

2007-02-14 Thread gsegura
Hello, I'm having this problem with a scenario similar to seamspace 
registration.  This exception is happening:

 java.lang.IllegalStateException: begin method invoked from a long running 
conversation, try using @Begin(join=true)

it throws every time I request register.xhtml, it doesn't render since the 
first request to the page.

It happens even if I just request that page directly from a fresh browser (I 
mean, no previous navegation in the application was performed)

The problem disappears if I delete any reference to newMember object. To make 
it less confusing here is the actual code:

The SFSB:
@Stateful
  | @Name(register)
  | public class RegistroAction implements Register {
  | 
  | @Logger Log log ;
  | 
  | @In EntityManager entityManager ;
  | 
  | @In(required = false)
  | private User newUser ;
  | 
  | @In
  | private Identity identity;
  | 
  | @Factory(newUser) @Begin
  | public void start() {
  | newUser = new User();
  | }
  | 
  | private String repassword;
  | 
  | public String getRepassword() {
  | return this.repassword;
  | }
  | 
  | public void setRepassword(String repassword) {
  | this.repassword = repassword;
  | }
  | ...
  | 


The page:

ui:define name=body
  | h:messages globalOnly=true styleClass=message /
  | h:form
  | s:validateAll
  | divNombre:  h:inputText 
value=#{newUser.name} required=true / /div
  | /s:validateAll
  | div class=actionButtons
  | h:commandButton value=Next 
action=#{register.next} /
  | /div
  | /h:form
  | /ui:define

Note that If I just remove #{newUser.name} the page is loaded properly

The entity bean declaration:
@Entity
  | @Table(name = user)
  | @NamedQueries( {
  | @NamedQuery(name = User.findById, query = SELECT p FROM User p WHERE 
p.id = :id),
  | @NamedQuery(name = User.findByName, query = SELECT p FROM User p 
WHERE p.name = :name),
  | @NamedQuery(name = User.findByEmail, query = SELECT p FROM User p 
WHERE p.email = :email),
  | @NamedQuery(name = User.findByLoginAndPassword, query = SELECT p 
FROM User p WHERE p.login = :login and p.password = :password)
  | })
  | public class User implements Serializable {
  | 
  | @Id
  | @GeneratedValue(strategy = GenerationType.AUTO)
  | @Column(name = id, nullable = false)
  | private Integer id;
  | 
  | @Column(name = name, nullable = false)
  | @NotNull
  | @Length(max=150)
  | private String name;  
  | 
  | @Column(name = email, nullable = false)
  | @NotNull
  | @Email
  | @Length(max=50)
  | private String email;
  | 
  | @Column(name = login, nullable = false)
  | @NotNull
  | @Length(max=50)
  | private String login;
  | 
  | @Column(name = password, nullable = false)
  | @NotNull
  | @Length(min=5,max=50)
  | private String password;
  | 
  | @OneToOne(cascade = CascadeType.ALL, mappedBy = contact)
  | private Club club ;
  | 
  | @JoinColumn(name = clientId, referencedColumnName = id)
  | @ManyToOne
  | private Client client;
  | 
  | @Version public int version ;
  | 
  | public User() {
  | }
  | 
  | public User(Integer id) { this.id = id; }
  | 
  | /** id */
  | public Integer getId() { return this.id; }
  | 
  | public void setId(Integer id) { this.id = id; }
  | 
  | /** nombre */
  | public String getNombre() { return this.name; }
  | 
  | public void setNombre(String name) { this.name = name; }
  | 
  | /** email */
  | public String getEmail() { return this.email; }
  | 
  | public void setEmail(String email) { this.email = email; }
  | 
  | /** login */
  | public String getLogin() { return this.login; }
  | 
  | public void setLogin(String login) { this.login = login; }
  | 
  | /** password */
  | public String getPassword() { return this.password; }
  | 
  | public void setPassword(String password) { this.password = password; }  
  
  | 
  | /** client */
  | public Client getClient() { return this.client; }
  | 
  | public void setClient(Client client) { this.client = client; }
  | 
  | /** club */
  | public Club getClub() { return club ; }
  | 
  | public void setClub(Club club) { this.club = club ; }
  | 
  | @Override
  | public int hashCode() {
  | int hash = 0;
  | hash += (this.id != null ? this.id.hashCode() : 0);
  | return hash;
  | }
  | 
  | @Override
  | public boolean equals(Object object) {
  | // TODO: Warning - 

[jboss-user] [JBoss Seam] - Re: how to redirecto back to intented page after login

2007-02-13 Thread gsegura
I couln't make these feature work until I change its scope from 
ScopeType.CONVERSATION to ScopeType.SESSION

I noticed that it wasn't the same instance of Redirect component which has been 
called in captureCurrentView and returnToCapturedView, so I realized it was 
because of the scope.


I just don't know if will be any undesirable side effects because of the change 
of scope.

Is there other way to make this work?

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4016048#4016048

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4016048
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: how to redirecto back to intented page after login

2007-02-13 Thread gsegura
Indeed, I had a end-conversation/ tag.
Thank you very much.

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4016113#4016113

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4016113
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - how to redirecto back to intented page after login

2007-02-12 Thread gsegura
When the user tries to access a protected page, I want to redirect to the login 
page if he hasn't logged in yet. 
And then, after successful login, redirect back to that given page.

Is there a setting to achieve this? Otherwise, is the best solution to 
implement a javax.servlet.Filter ?

regards,
Gerardo

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4015448#4015448

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4015448
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: how to redirecto back to intented page after login

2007-02-12 Thread gsegura
Thanks a lot for your reference. It's quite impressive the evolution speed of 
the framework.

By the way, the manual of 1.1.6GA doesn't contain such section (12.2.6) neither 
the seamspace example includes those nice tags.

Regards,


View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4015647#4015647

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4015647
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: how to trace failed entityManager injection?

2007-02-08 Thread gsegura
I know it seems trivial but I can not see where the problem is, please 
someone

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4012892#4012892

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4012892
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: how to trace failed entityManager injection?

2007-02-08 Thread gsegura
I'm very ashamed, it's all about the create property
@In(create=true) EntityManager entityManager ;

Wish I could delete the track of my late night foolness :)

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4013123#4013123

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4013123
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - how to trace failed entityManager injection?

2007-02-07 Thread gsegura
I'm using seam 1.1.5GA, and create a project with seam-gen. The authenticator 
component is generated automatically.
just filled the sql script (-dev.sql) to populate the database and when trying 
to test the login page this exception is thrown:

org.jboss.seam.RequiredException: In attribute requires value for component: 
authenticator.entityManager

The relevant part of Authenticator.java is:
@In EntityManager entityManager ;

I have the same name in components.xml (all generated by seam-gen):
core:managed-persistence-context name=entityManager 
persistence-unit-jndi-name=java:/hermes2EntityManagerFactory/

Also I checked with jndi viewer and the datasource and entityManagerFactory 
were published successfuly:
Java: Namespace
  |   +- hermes2EntityManagerFactory (class: 
org.jboss.ejb3.entity.InjectedEntityManagerFactory)
  |   +- hermes2Datasource (class: javax.sql.DataSource)


No other exception before that one. Just little before, the console showed some 
unrelated  (I think) errors , all identical to this one:
00:05:25,656 ERROR [STDERR] 8/02/2007 12:05:25 AM 
com.sun.facelets.compiler.TagLibraryConfig loadImplicit

Finally, I include some lines from server.log which made me think everything 
was ok (except the last one :P ):

  | 2007-02-07 23:59:26,859 DEBUG [org.jboss.seam.deployment.Scanner] found: 
org/jboss/seam/core/EntityManagerFactory.class
  | ...
  | 2007-02-07 23:59:28,593 INFO  [org.jboss.seam.Component] Component: 
entityManager, scope: CONVERSATION, type: JAVA_BEAN, class: 
org.jboss.seam.core.ManagedPersistenceContext
  | ...
  | 2007-02-07 23:59:28,609 DEBUG [org.jboss.seam.Component] 
entityManager.persistenceUnitJndiName=java:/hermes2EntityManagerFactory
  | ...
  | 2007-02-08 00:05:43,968 DEBUG [org.jboss.seam.Component] trying to inject 
with hierarchical context search: entityManager
  | ...
  | 2007-02-08 00:05:43,984 ERROR [org.jboss.seam.core.Exceptions] redirecting 
to debug page
  | org.jboss.seam.RequiredException: In attribute requires value for 
component: authenticator.entityManager
  | 

Excuse such a verbose post but I just don't have any clue.

how could I check why is failing the entityManager injection??
help please. 

please!!

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4012858#4012858

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4012858
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: how to trace failed entityManager injection?

2007-02-07 Thread gsegura
I reproduce the whole content here,  keep in mind that I had not tampered that 
file at all since seam-gen created it.

   core:init debug=true jndi-pattern=hermes2/#{ejbName}/local/
  |  
  |core:manager concurrent-request-timeout=500 
  |  conversation-timeout=12 
  |  conversation-id-parameter=cid 
  |  conversation-is-long-running-parameter=clr/
  | 
  |core:pages no-conversation-view-id=/home.xhtml/
  |
  |core:managed-persistence-context name=entityManager
  |
persistence-unit-jndi-name=java:/hermes2EntityManagerFactory/
  | 
  |core:ejb installed=false/
  |
  |drools:rule-base name=securityRules
  |drools:rule-filesvalue/security.drl/value/drools:rule-files
  |/drools:rule-base
  | 
  |security:identity authenticate-method=#{authenticator.authenticate}/

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4012863#4012863

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4012863
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user