T5: Hibernate and services

2008-10-14 Thread Angelo Chen

Hi,

I have some tapestry-hibernate related questions:

1) if I have two concurrent services(A and B), each has Session injected. do
A and B have their own transaction?

2) I have a table config that has a field 'nextID':

  2.1 IDService has a method 'NextID()' which get the value from
'nextID' and increment it
  2.2 AppendSerivce which uses IDService's NextID to get a number and
assign to a new object, persist it

if I have two instances of UserService(A and B) running, A will be
successful in getting a new ID while B fails because it gets the same ID as
A, any idea how to solve this problem?

Thanks,

Angelo 
   
-- 
View this message in context: 
http://www.nabble.com/T5%3A-Hibernate-and-services-tp19985886p19985886.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



Re: T5: Hibernate and services

2008-06-27 Thread Howard Lewis Ship
Dependends on the version of Tapestry.  Earlier versions included an
automatic commit.

On Thu, Jun 26, 2008 at 7:44 PM, Angelo Chen [EMAIL PROTECTED] wrote:

 Hi,

 As what I understand now that transaction has to be committed to persist the
 objects, following is a diapatcher, there is no commit, but the new PageLog
 got persisted too, any idea? thanks,

 Angelo


 public class LoggingDispatcher implements Dispatcher {

private final HibernateSessionManager sessionManager;

public LoggingDispatcher(ApplicationStateManager asm, RequestGlobals
 requests, HibernateSessionManager sessionManager, IPLookup ipLookup) {
this.sessionManager = sessionManager;
}

public boolean dispatch(Request request, Response response) throws
 IOException {

PageLog log = new PageLog();
sessionManager.getSession().save(log);

return false;
}
 --
 View this message in context: 
 http://www.nabble.com/T5%3A-Hibernate-and-services-tp18147187p18147187.html
 Sent from the Tapestry - User mailing list archive at Nabble.com.


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





-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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



Re: T5: Hibernate and services

2008-06-27 Thread Angelo Chen

Hi,

This is version 5.0.13, and I turned off the auto commit,
 property name=hibernate.connection.autocommitfalse/property


Howard Lewis Ship wrote:
 
 Dependends on the version of Tapestry.  Earlier versions included an
 automatic commit.
 
 On Thu, Jun 26, 2008 at 7:44 PM, Angelo Chen [EMAIL PROTECTED]
 wrote:

 Hi,

 As what I understand now that transaction has to be committed to persist
 the
 objects, following is a diapatcher, there is no commit, but the new
 PageLog
 got persisted too, any idea? thanks,

 Angelo


 public class LoggingDispatcher implements Dispatcher {

private final HibernateSessionManager sessionManager;

public LoggingDispatcher(ApplicationStateManager asm, RequestGlobals
 requests, HibernateSessionManager sessionManager, IPLookup ipLookup) {
this.sessionManager = sessionManager;
}

public boolean dispatch(Request request, Response response) throws
 IOException {

PageLog log = new PageLog();
sessionManager.getSession().save(log);

return false;
}
 --
 View this message in context:
 http://www.nabble.com/T5%3A-Hibernate-and-services-tp18147187p18147187.html
 Sent from the Tapestry - User mailing list archive at Nabble.com.


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


 
 
 
 -- 
 Howard M. Lewis Ship
 
 Creator Apache Tapestry and Apache HiveMind
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/T5%3A-Hibernate-and-services-tp18147187p18155441.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



T5: Hibernate and services

2008-06-26 Thread Angelo Chen

Hi,

As what I understand now that transaction has to be committed to persist the
objects, following is a diapatcher, there is no commit, but the new PageLog
got persisted too, any idea? thanks,

Angelo


public class LoggingDispatcher implements Dispatcher {

private final HibernateSessionManager sessionManager;

public LoggingDispatcher(ApplicationStateManager asm, RequestGlobals
requests, HibernateSessionManager sessionManager, IPLookup ipLookup) {
this.sessionManager = sessionManager;
}

public boolean dispatch(Request request, Response response) throws
IOException {

PageLog log = new PageLog();
sessionManager.getSession().save(log);

return false;
}
-- 
View this message in context: 
http://www.nabble.com/T5%3A-Hibernate-and-services-tp18147187p18147187.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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