Author: tolusha
Date: 2010-04-02 05:41:21 -0400 (Fri, 02 Apr 2010)
New Revision: 2214
Modified:
core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/GroupDAOImpl.java
core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/MembershipDAOImpl.java
core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java
core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserProfileDAOImpl.java
Log:
EXOJCR-564: open session after preSave()
Modified:
core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/GroupDAOImpl.java
===================================================================
---
core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/GroupDAOImpl.java 2010-04-02
09:16:53 UTC (rev 2213)
+++
core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/GroupDAOImpl.java 2010-04-02
09:41:21 UTC (rev 2214)
@@ -112,6 +112,8 @@
if (broadcast)
preSave(child, true);
childImpl.setId(groupId);
+
+ session = service_.openSession();
session.save(childImpl);
if (broadcast)
postSave(child, true);
@@ -120,9 +122,9 @@
public void saveGroup(Group group, boolean broadcast) throws Exception
{
- Session session = service_.openSession();
if (broadcast)
preSave(group, false);
+ Session session = service_.openSession();
session.update(group);
if (broadcast)
postSave(group, false);
@@ -131,9 +133,9 @@
public Group removeGroup(Group group, boolean broadcast) throws Exception
{
- Session session = service_.openSession();
if (broadcast)
preDelete(group);
+ Session session = service_.openSession();
session.delete(group);
List entries = session.createQuery(queryFindGroupByParent).setString(0,
group.getId()).list();
for (int i = 0; i < entries.size(); i++)
Modified:
core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/MembershipDAOImpl.java
===================================================================
---
core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/MembershipDAOImpl.java 2010-04-02
09:16:53 UTC (rev 2213)
+++
core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/MembershipDAOImpl.java 2010-04-02
09:41:21 UTC (rev 2214)
@@ -82,9 +82,9 @@
public void createMembership(Membership m, boolean broadcast) throws Exception
{
- Session session = service_.openSession();
if (broadcast)
preSave(m, true);
+ Session session = service_.openSession();
session.save(IdentifierUtil.generateUUID(m), m);
if (broadcast)
postSave(m, true);
@@ -114,7 +114,6 @@
+ " because membership type is null");
}
- Session session = service_.openSession();
MembershipImpl membership = new MembershipImpl();
// User user
// =(User)service_.findExactOne(session,UserHandlerImpl.queryFindUserByName,
@@ -130,6 +129,7 @@
if (broadcast)
preSave(membership, true);
membership.setId(id);
+ Session session = service_.openSession();
session.save(membership);
if (broadcast)
postSave(membership, true);
@@ -138,9 +138,9 @@
public void saveMembership(Membership m, boolean broadcast) throws Exception
{
- Session session = service_.openSession();
if (broadcast)
preSave(m, false);
+ Session session = service_.openSession();
session.update(m);
if (broadcast)
postSave(m, false);
@@ -156,6 +156,7 @@
{
if (broadcast)
preDelete(m);
+ session = service_.openSession();
session.delete(m);
if (broadcast)
postDelete(m);
@@ -166,7 +167,6 @@
public Collection removeMembershipByUser(String username, boolean broadcast) throws
Exception
{
- Session session = service_.openSession();
Collection collection = findMembershipsByUser(username);
Iterator iter = collection.iterator();
while (iter.hasNext())
@@ -176,6 +176,7 @@
{
if (broadcast)
preDelete(m);
+ Session session = service_.openSession();
session.delete(m);
if (broadcast)
postDelete(m);
Modified:
core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java
===================================================================
---
core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java 2010-04-02
09:16:53 UTC (rev 2213)
+++
core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java 2010-04-02
09:41:21 UTC (rev 2214)
@@ -77,10 +77,11 @@
public void createUser(User user, boolean broadcast) throws Exception
{
+ if (broadcast)
+ preSave(user, true);
Session session = service_.openSession();
Transaction transaction = session.beginTransaction();
- if (broadcast)
- preSave(user, true);
+
UserImpl userImpl = (UserImpl)user;
userImpl.setId(user.getUserName());
session.save(user);
@@ -91,9 +92,9 @@
public void saveUser(User user, boolean broadcast) throws Exception
{
- Session session = service_.openSession();
if (broadcast)
preSave(user, false);
+ Session session = service_.openSession();
session.merge(user);
// session.update(user);
if (broadcast)
@@ -116,6 +117,7 @@
if (broadcast)
preDelete(foundUser);
+ session = service_.openSession();
session.delete(foundUser);
if (broadcast)
postDelete(foundUser);
Modified:
core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserProfileDAOImpl.java
===================================================================
---
core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserProfileDAOImpl.java 2010-04-02
09:16:53 UTC (rev 2213)
+++
core/branches/2.4.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserProfileDAOImpl.java 2010-04-02
09:41:21 UTC (rev 2214)
@@ -92,6 +92,7 @@
upd.setUserProfile(profile);
if (broadcast)
preSave(profile, true);
+ session = service_.openSession();
session.save(profile.getUserName(), upd);
if (broadcast)
postSave(profile, true);
@@ -102,6 +103,7 @@
upd.setUserProfile(profile);
if (broadcast)
preSave(profile, false);
+ session = service_.openSession();
session.update(upd);
if (broadcast)
postSave(profile, false);
@@ -119,6 +121,7 @@
UserProfile profile = upd.getUserProfile();
if (broadcast)
preDelete(profile);
+ session = service_.openSession();
session.delete(upd);
if (broadcast)
postDelete(profile);