Peter Schröder a écrit :
you may create an interface with a method 'getEntityManager()' and implement 
that method like you did before.
than register a service in your hivemind.xml like

<service-point id="your service name" interface="your interface"> <invoke-factory>
            <construct class="your implementation" />
</invoke-factory> </service>

Hi,

Just to fill the mailing list archive ... A little presentation of Hivemind and it's service-point is available on the wiki at :

   http://wiki.apache.org/tapestry/Hivemind4Beginners

Cheers
Cyrille

you can than receive it in your java-class using @InjectObject

take a look at the hello-world example app.

-----Ursprüngliche Nachricht-----
Von: Cyrille37 [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 5. Dezember 2006 03:10
An: Tapestry users
Betreff: please, some help with Hivemind

Hello,

step by step, I'm learning Tapestry 4.0.2 with Netbeans 5.5 ...
With that Netbeans version it's really easy to create persistence stuff. It makes pojo class and persistence unit with a wizard. Great.

I've test the persistence in a page property, by a very dirty fashion. But I know that it's working.

Here is the ugly code :

import org.apache.tapestry.html.BasePage ;
import javax.persistence.*; // implemented with TopLink
public abstract class DB01 extends BasePage
{
    EntityManagerFactory factory;
    EntityManager manager;
    public String getTest01()
    {
        factory = Persistence.createEntityManagerFactory("Tap02PU");
        manager = factory.createEntityManager();
        return "Ok, DB is connected" ;
    }
}

So, I come to you because your are so nice, that you will help me to initialize the EntityManager with Hivemind
;-)

Please can you tell me how to declare the serive ? There are so many things to learn : Form, Component, ... That I would like to not spend 2 days to find how to instantiate the EntityManager and how to access from pages.

Promess, in several days, I will digg into Hivemind documentation (I'll try to not use Spring but only Hivemind).

Thanks a lot
Cyrille



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to