Re: Using Hibernate in DAOs

2012-02-28 Thread Ferran Maylinch
Thank you very much for your answers. So, if I understood you well, I can let Tapestry inject the Session in my DAOs this way: class MyDAO { private final Session session; public MyDAO (Session session) { this.session = session; } public void performSomeOperationOnSession() { .

Re: Using Hibernate in DAOs

2012-02-28 Thread Ferran Maylinch
About creating threads explicitly... do we need to use PerthreadManager? I saw you recommend it here: http://tapestry.1045711.n5.nabble.com/Reusing-tapestry-hibernate-session-in-a-thread-td5438833.html On Tue, Feb 28, 2012 at 10:30 AM, Ferran Maylinch wrote: > Thank you very much for your answer

classloader issues casting objects to their tapestry type

2012-02-28 Thread Paul Stanton
Hi Tapestry committers/experts (in particular) I while back I posted that I had found a classloader issue within one of my services when casting a Zone to a Zone. I realise that what I'm trying to do isn't quite the 'tapestry recommended approach', but since some of my pages update many zones

Re: Using Hibernate in DAOs

2012-02-28 Thread Paul Stanton
Ferran, You can just @Inject the session in if you want to write less code: class MyDAO { @Inject private Session session; public void performSomeOperationOnSession() { ... } } and then yes, you must use PerThreadManager explicitly if you are creating your own threads using the Dao.

Re: Using Hibernate in DAOs

2012-02-28 Thread Paul Stanton
Sorry, forgot to mention, you can @Inject if your Dao is a service in tapestry-ioc... On 28/02/2012 8:37 PM, Ferran Maylinch wrote: About creating threads explicitly... do we need to use PerthreadManager? I saw you recommend it here: http://tapestry.1045711.n5.nabble.com/Reusing-tapestry-hiber

Percent sign in message properties file

2012-02-28 Thread nquirynen
Hi all, In a .properties file of a page I have: test=% I just want to show the percent symbol, but then I get this error: org.apache.tapestry5.ioc.internal.util.TapestryException Conversion = '%' I have tried different things like with as results: Change properties file to UTF8, unicode escap

Re: classloader issues casting objects to their tapestry type

2012-02-28 Thread Thiago H. de Paula Figueiredo
On Tue, 28 Feb 2012 06:40:41 -0300, Paul Stanton wrote: Hi Tapestry committers/experts (in particular) Hi! Please take note of the method "idealImplementation". This is how I expected to be able to implement the functionality, however a ClassCastException is thrown casting the Componen

Re: Reusing tapestry hibernate session in a thread

2012-02-28 Thread fmaylinch
Howard, I tried the ptm.run(...) idiom you posted and I found that the changes are not committed. How can I commit the changes I perform inside that thread? I suppose I can't add @CommitAfter to the method that starts the thread because that method will probably end before the thread. But I tried

Re: Percent sign in message properties file

2012-02-28 Thread Shing Hing Man
It is rather strange. It works for me with encoding UTF-8. I am using Tapestry 5.3.  Shing     From: nquirynen To: users@tapestry.apache.org Sent: Tuesday, February 28, 2012 10:40 AM Subject: Percent sign in message properties file Hi all, In a .properties

Re: classloader issues casting objects to their tapestry type

2012-02-28 Thread Paul Stanton
Thanks Thiago, I wasn't fully aware of the 'controlled package' concept, however it does make sense. I tried casting to 'ClientBodyElement' and while the cast works, I found the zone update does not succeed since at that point the object has not been assigned a clientId. I find this strange si

Re: Reusing tapestry hibernate session in a thread

2012-02-28 Thread Paul Stanton
You will have to call commit directly, or via HibernateSessionManager. Have a look at how CommitAfterWorker uses HibernateSessionManager. You need to do the same within your thread. On 28/02/2012 10:11 PM, fmaylinch wrote: Howard, I tried the ptm.run(...) idiom you posted and I found that th

Re: Reusing tapestry hibernate session in a thread

2012-02-28 Thread fmaylinch
Sorry, it was a newbie mistake... I simplified my test and found that even a simple call to a service (no extra threads involved) was not being persisted, and the cause was the lack of adviseTransactions() method in the module. @Match("MyService") public static void adviseTransact

Re: classloader issues casting objects to their tapestry type

2012-02-28 Thread Thiago H. de Paula Figueiredo
On Tue, 28 Feb 2012 08:48:28 -0300, Paul Stanton wrote: Thanks Thiago, I wasn't fully aware of the 'controlled package' concept, however it does make sense. :) I tried casting to 'ClientBodyElement' and while the cast works, I found the zone update does not succeed since at that point t

Re: Using composite key with value encoder.

2012-02-28 Thread George Christman
Does anybody else have any suggestions on this topic? Unfortunately I'm required to use a value encoder in my situation and not sure how to get it to work with a composite key. Thanks in advance. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Using-coposite-key-with-valu

Re: Using composite key with value encoder.

2012-02-28 Thread Lenny Primak
Take a look at source code for Tapestry-JPA On Feb 28, 2012, at 9:14 AM, George Christman wrote: > Does anybody else have any suggestions on this topic? Unfortunately I'm > required to use a value encoder in my situation and not sure how to get it > to work with a composite key. Thanks in advanc

How to get values in a form with dynamic fields?

2012-02-28 Thread Tapbeg
Hi! Firstly, sorry for my English... I hope you understand me... I'm doing a project about form management (such as fill, delete...). When user wants to fill a form, has to select one from an available list of forms. Depending on selection, form will have different number of fields (fields are ta

Re: Using composite key with value encoder.

2012-02-28 Thread Thiago H. de Paula Figueiredo
On Tue, 28 Feb 2012 11:53:43 -0300, Lenny Primak wrote: Take a look at source code for Tapestry-JPA Or just think about it: you have an object, two or more values used as primary key. Now you need to transform this into a string. Concatenate them all using some character. Let's say ':'.

Re: How to get values in a form with dynamic fields?

2012-02-28 Thread Thiago H. de Paula Figueiredo
On Tue, 28 Feb 2012 09:48:51 -0300, Tapbeg wrote: Hi! Firstly, sorry for my English... I hope you understand me... I'm doing a project about form management (such as fill, delete...). When user wants to fill a form, has to select one from an available list of forms. Depending on selection, fo

Re: Using composite key with value encoder.

2012-02-28 Thread George Christman
Thanks Thiago, this is the method I ended up implementing. I wasn't sure if there was a better way of handling this. I'm using a custom component that uses a hidden field, do you feel there will be any kind of security risk publishing the concatenated id in the hidden field, or do you think they sh

Re: Using composite key with value encoder.

2012-02-28 Thread Thiago H. de Paula Figueiredo
On Tue, 28 Feb 2012 16:15:17 -0300, George Christman wrote: Thanks Thiago, this is the method I ended up implementing. I wasn't sure if there was a better way of handling this. I'm using a custom component that uses a hidden field, do you feel there will be any kind of security risk pub

Same service known by multiple interfaces?

2012-02-28 Thread Kalle Korhonen
I have an interesting case where I'm trying to fit third-party code to work under Tapestry IoC. A service is made available by binding to the "main" interface of a class, but I know the implementation supports another interface. Is there a way to make it known with the other interface as well for t

Re: Same service known by multiple interfaces?

2012-02-28 Thread Howard Lewis Ship
I've thought about these "chimeric" services before. Let's say you want to seperate services, A and B. You have an implementation class IM that implements both A and B. Define a new interface, C: public interface C { A getA(); B getB(); } public class CImpl implements C { public final IM im

Re: Same service known by multiple interfaces?

2012-02-28 Thread Kalle Korhonen
Thanks Howard. Yes, that's quite a bit of boilerplate but looks like the only other option, especially if you want both A and B separately known as services. Kalle On Tue, Feb 28, 2012 at 12:03 PM, Howard Lewis Ship wrote: > I've thought about these "chimeric" services before. > > Let's say you

Re: How to get values in a form with dynamic fields?

2012-02-28 Thread Tapbeg
Thank you for your answer and sorry, but I've forgotten that I have as persistent classes: type of form, field and value, obviously all in database. (Additional information: I'm working with Hibernate, Spring and Tapestry) When a type of form is selected, the list of associated fields (see loop)

Re: How to get values in a form with dynamic fields?

2012-02-28 Thread Thiago H. de Paula Figueiredo
On Tue, 28 Feb 2012 16:53:48 -0300, Tapbeg wrote: Thank you for your answer and sorry, but I've forgotten that I have as persistent classes: type of form, field and value, obviously all in database. (Additional information: I'm working with Hibernate, Spring and Tapestry) When a type of for

Re: How to get values in a form with dynamic fields?

2012-02-28 Thread Tapbeg
Thiago H de Paula Figueiredo wrote > > On Tue, 28 Feb 2012 16:53:48 -0300, Tapbeg wrote: > > Have you tried to @Persist the list of objects and take the updated values > from there? > > No, I haven't. It's a good idea, but I think it is not exactly what I need. The problem is I

Re: How to get values in a form with dynamic fields?

2012-02-28 Thread Thiago H. de Paula Figueiredo
On Tue, 28 Feb 2012 19:59:18 -0300, Tapbeg wrote: No, I haven't. It's a good idea, but I think it is not exactly what I need. The problem is I don't know how to store each value in each iteration, for instance, in an ArrayList. The list itself stores the values. -- Thiago H. de Paula Figu

Re: Question about caching of assets ...

2012-02-28 Thread Gunnar Eketrapp
Hi! Caching seems complex and I am fairly new to it. I found out that T5 delivers a 304 for assets that have not been modified since they where fetched. I.e. there is one server request per asset. [When serving an asset T5 delivers a last modified header. And clients sends If-Modified-Since when