[JBoss Cache: Core Edition] - Re: on child insert parent, child collection updated in DB b
by bstansberry@jboss.com
"dukehoops" wrote :
| I didn't understand your comment above. Were you saying that you will take my test source and adapt it to hibernate-jbc test suite or were you suggesting I do it?
I meant I would do it, although if you want to do it and submit a patch that would be much appreciated. :-) I'm travelling next week so I wouldn't be able to port it for another week.
anonymous wrote :
| I took another look at hib-jbc project but could not find any examples of tests exercising hibernate and jbc *3*. I looked here:
| http://anonsvn.jboss.org/repos/hibernate/core/trunk/cache-jbosscache2/
Have another look. :)
An hour or so ago I committed a bunch of stuff for http://opensource.atlassian.com/projects/hibernate/browse/HHH-3585 which is the task to move to JBC 3. That task is really just to port tests from a branch where we proved last fall that the existing code already works with JBC 3. I added today some subtasks to HHH-3585 today related to some renaming stuff related to this, but the fact that those changes will eventually happen shouldn't prevent adding tests.
anonymous wrote :
| Debugging tells me I am using TransactionalAccessDelegate. Shouldn't OptimisticTxDelegate be used since my Domain object do use Hibernate's @Version? Or is that irrelevant because the two choices translate to deprecated Optimistic or Pessimistic locking in JBC and we're using MVCC?
Correct it relates to JBC's OPTIMISTIC locking scheme, so isn't relevant to MVCC.
anonymous wrote :
| I also have caches configured as Srping Beans (with Configuration and RuntimeConfig also spring beans) and use org.jboss.cache.CacheFactory directly to build caches (as described in JBC3 User Guide). org.hibernate.cache.jbc2 on the other hand uses org.jboss.cache.CacheManager to do the same. The reason I went with that approach is that org.hibernate.cache.jbc2 seems to want to work of jbc2-styled treecache.xml config only and does not parse org.jboss.cache.config.Configuration
If JBC 3 is used, the CacheManager can parse a JBC3-format file. It can also parse the legacy format. Building up the Configuration POJO and then injecting it into the CacheManager works too; that's what JBoss AS 5 does, just using the JBoss Microcontainer instead of Spring.
I'll have to think about your REPEATABLE_READ issue. Do you see that with PESSIMISTIC or OPTIMISTIC instead of MVCC?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4215859#4215859
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4215859
15 years, 10 months
[Persistence, JBoss/CMP, Hibernate, Database] - AnnotationConfiguration hacks
by msilva
Hi,
We are working on an annotation extension for hibernate and we have 2 problems:
1. this annotation should be only used on transient properties. However we wouldn't like to force users to use @Transient in addition to ours and we don't know how to do it without the required annotation (@Transient)
2. this annotation indicates that another table will be created and it must be mapped with the metadata information of the property annotated. We don't know how to copy this information to the new table. Example: @lob, @version, @temporal etc.
We thought about 2 approaches for this:
1. We would let the AnnotationConfiguration parse the property including all of its annotations, then we would copy from the Property class the needed information and afterwards we would delete the original configuration.
2. We wouldn't let the AnnotationConfiguration find this property (somehow) but we would use some inner class or method from hibernate-annotation to parse the annotations. Finally, we would use the parsed information on the new table.
Does anybody have a suggestion on how to do it?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4215848#4215848
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4215848
15 years, 10 months
[JBoss Cache: Core Edition] - Re: on child insert parent, child collection updated in DB b
by dukehoops
Sorry, premature 'send' of above. Here's missing source code:
/**
| *
| * @param ltesterUserName
| * @return current userSession or null
| */
| private UserSession getCurrentUserSession(final String ltesterUserName) throws Exception {
|
| LOG.debug("start getCurrentUserSession method user=" + ltesterUserName);
|
| try {
| return (UserSession) txTemplate.executeWithException(new TransactionCallbackWithException() {
|
| public Object doInTransactionWithException(TransactionStatus status) throws Exception {
|
| //add user session, throw exception if one does not exist
|
| LOG.debug("before findByName user=" + ltesterUserName);
| final User usr = getUserDao().findByNameChecked(ltesterUserName);
|
| LOG.debug("before usr.getCurrentUserSession user=" + ltesterUserName);
| final UserSession us = usr.getCurrentUserSession();
| LOG.debug("after usr.getCurrentUserSession user=" + ltesterUserName);
| return us;
| }
| });
| } finally {
| LOG.debug("end getCurrentUserSession user=" + ltesterUserName);
| }
|
| }
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4215841#4215841
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4215841
15 years, 10 months
[JBoss Cache: Core Edition] - Re: on child insert parent, child collection updated in DB b
by dukehoops
REPEATABLE_READ fails with 1 User
Now I am even more confused. I just changed jbc isolation from read_committed to repeatable_read and now this test fails with *1* user on the very first iteration:
Failure:
anonymous wrote : runner for user=ltester-100000 did not complete all iterations; cause=[ThreadId=1] userSession null after successful login; user=ltester-100000 java.lang.IllegalStateException: userSession null after successful login; user=ltester-100000 at com.doppelganger.service.userservice.MultiuserLoginTest.login(MultiuserLoginTest.java:120)
Test code:
| public void login(final String ltesterUserName) throws Exception {
| LOG.debug("begin actual login user=" + ltesterUserName);
|
| //add userSession
| final UserSession us1 = (UserSession) txTemplate.executeWithException(new TransactionCallbackWithException() {
|
| public Object doInTransactionWithException(TransactionStatus status) throws Exception {
|
| //add user session, throw exception if one does not exist
| LOG.debug("before findByName user=" + ltesterUserName);
| final User usr = getUserDao().findByNameChecked(ltesterUserName);
|
| UserSession userSession = new UserSession(usr);
| userSession.setToken(UUID.randomUUID().toString());
|
| userSession.setLoginTime(new Timestamp(System.currentTimeMillis()));
| userSession.resetSessionTimeout(); //ok here
|
| //attach userSession to User
| LOG.debug("before initCurrentUserSession user=" + ltesterUserName);
| usr.initCurrentUserSession(userSession);
| LOG.debug("after initCurrentUserSession user=" + ltesterUserName);
|
| return userSession;
|
| }
| });
|
| LOG.debug("end actual login user=" + ltesterUserName);
|
| //check that we can get at userSession
| final UserSession us2 = getCurrentUserSession(ltesterUserName);
|
| if (us2 == null) {
| throw new IllegalStateException("userSession null after successful login; user=" + ltesterUserName);
| }
|
| if (!us1.equals(us2)) {
| throw new IllegalStateException("us1 != us2");
| }
| }
Any ideas?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4215839#4215839
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4215839
15 years, 10 months