you must generate hibernate.cfg.xml
have your entities in entities package
add this to your AppModule

public static void
contributeValueEncoderSource(MappedConfiguration<Class<?>,
ValueEncoderFactory<ObjektMitSeqID>> configuration,
Session session
) {
               configuration.add(ObjektMitSeqID.class, new
HibernateValueEncoderFactory(session));
}

that is for getting the session


here is my hibernate.cfg.xml
tapestry will add your entities to the session factory if they are in
entities package

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd";>
<hibernate-configuration>
    <session-factory>
        <property name="hibernate.connection.driver_class">
org.gjt.mm.mysql.Driver</property>
        <property name="hibernate.connection.url
">jdbc:mysql://localhost/dbname?charset=utf8&amp;autoReconnect=true</property>
        <property name="hibernate.dialect">
org.hibernate.dialect.MySQLDialect</property>
        <property name="hibernate.connection.username">uname</property>
        <property name="hibernate.connection.password"></property>

        <!-- configuration pool via c3p0-->
        <property name="connection.provider_class">
org.hibernate.connection.C3P0ConnectionProvider</property>
        <property name="hibernate.c3p0.acquire_increment">1</property>
        <property name="hibernate.c3p0.idle_test_period">100</property> <!--
seconds -->
        <property name="hibernate.c3p0.max_size">10</property>
        <property name="hibernate.c3p0.max_statements">0</property>
        <property name="hibernate.c3p0.min_size">1</property>
        <property name="hibernate.c3p0.timeout">100</property> <!-- seconds
-->

    </session-factory>
</hibernate-configuration>


On 9/10/07, Marcus Schmidke <[EMAIL PROTECTED]> wrote:
>
> Yes ... I've read ... parts of it more than once ... but
> unfortunately, I do not seem to be clever enough.
>
> I want to write a value encoder which maps Hibernate Entities to their
> IDs and vice versa.
>
> I've written
> - a HibernateValueEncoder
> - a HibernateValueEncoderFactory
> - an AppModule containing the following:
>
> public static void
> contributeValueEncoderSource(MappedConfiguration<Class<?>,
> ValueEncoderFactory<ObjektMitSeqID>> configuration) {
>                 configuration.add(ObjektMitSeqID.class, new
> HibernateValueEncoderFactory());
> }
>
> (where ObjektMitSeqID is the base class of all of my Hibernate Entities).
>
> This all works fine, no problem, but only as long as I use my own
> HibernateUtil to create a Session. But I would prefer using tapestry
> to create the Hibernate Session.
>
> Since I don't create a service on my own, but only contribute
> configuration to an existing service, I have absolutely no plan how or
> where to inject the Hibernate Session.
>
> Perhaps I'm a little bit confused. I don't know. Do you have another hint?
>
>
> Marcus.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to