a HibernateListener is something completely different.It is not required to
config a TransactionFactory in your config xml. There is implicitly always
one.. (if I remember well, since I always use Spring to configure my
Hibernate...)

I suggest that you look first to some hibernate examples, since these issues
are not related to wicket.



On Tue, Oct 6, 2009 at 9:53 AM, Peter Arnulf Lustig <uuuuu...@yahoo.de>wrote:

> ok!
> So I need  a listener class  like HibernateListener and a
> Transactionfactory in the config xml ?
>
>
>
>
>
>
> ----- Ursprüngliche Mail ----
> Von: Pieter Degraeuwe <pieter.degrae...@systemworks.be>
> An: users@wicket.apache.org
> Gesendet: Dienstag, den 6. Oktober 2009, 09:49:42 Uhr
> Betreff: Re: org.hibernate.HibernateException: createCriteria is not valid
>  without active transaction
>
> Indeed, when you start a transaction and get an object from the database,
> hibernate wil persist changes to that object when you transaction (and thus
> sesseion) is still open.
> This is normal behaviour.
>
> Note that it is in most cases a bad habit to use manual transaction
> management...
>
> On Tue, Oct 6, 2009 at 9:44 AM, Peter Arnulf Lustig <uuuuu...@yahoo.de
> >wrote:
>
> > How can I do it manually?
> >
> >
> > For example: I have a "DataProvider" class with a method:
> >
> > public static Administrator getAdministrator(Integer id) {
> >            Administrator administrator= (Administrator)
> >
> HibernateUtil.getSessionFactory().getCurrentSession().createCriteria(Administrator.class).add(Property.forName("id").eq(id)).uniqueResult();
> >            return administrator;
> >
> >        }
> >
> >
> > I get the error message. How shall I modify the code?
> > I tried it with Transaction tx = ... and then tx.begin() tx.commit()  --
> > but then suddenly hibernate tries permanently to update an object...
> wired !
> >
> >
> >
> >
> > ----- Ursprüngliche Mail ----
> > Von: Pieter Degraeuwe <pieter.degrae...@systemworks.be>
> > An: users@wicket.apache.org
> > Gesendet: Dienstag, den 6. Oktober 2009, 09:29:58 Uhr
> > Betreff: Re: org.hibernate.HibernateException: createCriteria is not
> valid
> >  without active transaction
> >
> > You did not setup your transactions properly.
> > Or you start your transaction manually, or if you like spring, you can
> let
> > spring manage it. (just add your transction annotations to your services,
> > and, done !
> >
> > On Tue, Oct 6, 2009 at 9:15 AM, Peter Arnulf Lustig <uuuuu...@yahoo.de
> > >wrote:
> >
> > >  get this error always! I don't understand why.
> > >
> > > this is my hibernate.cfg.xml
> > >
> > >
> > > <hibernate-configuration>
> > >  <session-factory name="session1">
> > >    <property
> > > name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
> > >    <property
> > >
> name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
> > >    <property
> > >
> >
> name="hibernate.connection.url">jdbc:mysql://localhost:3306/mydb</property>
> > >    <property name="hibernate.connection.username">root</property>
> > >    <property
> > >
> >
> name="hibernate.current_session_context_class">org.hibernate.context.ThreadLocalSessionContext</property>
> > >    <mapping resource="org/omikron/test/data/Ticket.hbm.xml"/>
> > >    <mapping resource="org/omikron/test/data/Testprocedure.hbm.xml"/>
> > >    <mapping resource="org/omikron/test/data/Tag.hbm.xml"/>
> > >    <mapping resource="org/omikron/test/data/Testentity.hbm.xml"/>
> > >    <mapping resource="org/omikron/test/data/Questionset.hbm.xml"/>
> > >    <mapping resource="org/omikron/test/data/Administrator.hbm.xml"/>
> > >    <mapping resource="org/omikron/test/data/Systemsetting.hbm.xml"/>
> > >    <mapping resource="org/omikron/test/data/Question.hbm.xml"/>
> > >  </session-factory>
> > > </hibernate-configuration>
> > >
> > >
> > >
> > > Do you have an idea?
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > > For additional commands, e-mail: users-h...@wicket.apache.org
> > >
> > >
> >
> >
> > --
> > Pieter Degraeuwe
> > Systemworks bvba
> > Belgiëlaan 61
> > 9070 Destelbergen
> > GSM: +32 (0)485/68.60.85
> > Email: pieter.degrae...@systemworks.be
> > visit us at http://www.systemworks.be
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
>
>
> --
> Pieter Degraeuwe
> Systemworks bvba
> Belgiëlaan 61
> 9070 Destelbergen
> GSM: +32 (0)485/68.60.85
> Email: pieter.degrae...@systemworks.be
> visit us at http://www.systemworks.be
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Pieter Degraeuwe
Systemworks bvba
Belgiëlaan 61
9070 Destelbergen
GSM: +32 (0)485/68.60.85
Email: pieter.degrae...@systemworks.be
visit us at http://www.systemworks.be

Reply via email to