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>
you can than receive it in your java-class using @InjectObject
take a look at the hello-world example app.
Hello Peter,
Thanks for your help.
I had some decoration to your example, is that good, not necessary ?
hivemodule.xml :
<module id="tap02" version="1.0.0">
<service-point id="DataManagerFactory"
interface="tap02.data.DataManagerFactory">
<invoke-factory service-id="hivemind.BuilderFactory"
model="singleton">
<construct class="tap02.data.DataManagerFactoryImpl"
initialize-method="initialize">
</construct>
</invoke-factory>
</service-point>
...
</module>
I spent some time to find the right @InjectObject address syntax.
I started without the module's id first part address ... But the good
syntax is :
@InjectObject("service:tap02.DataManagerFactory")
Thanks again and have a nice day.
Cyrille
-----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]