From 3b8aa7c1bb86094f7dfe7684acc07f66be3aa40b Mon Sep 17 00:00:00 2001
From: srosse <none@none>
Date: Tue, 7 Jan 2014 09:19:54 +0100
Subject: [PATCH] OO-932: upgrade Hibernate to 4.3, Infinispan to 6.0.1 ,
 change the mapping of UserImpl (properties is a keyword) ...

---
 pom.xml                                       | 18 ++++----
 .../basesecurity/BaseSecurityManager.java     | 21 +++++----
 .../manager/PersistentTaskDAO.java            |  2 +-
 .../model/PersistentTaskModifier.java         |  3 +-
 .../olat/group/manager/BusinessGroupDAO.java  |  4 +-
 .../org/olat/ims/qti/QTIResultManager.java    |  2 +-
 .../manager/InstantMessageDAO.java            | 14 +++---
 .../model/InstantMessageImpl.java             |  3 +-
 .../model/InstantMessageNotificationImpl.java |  3 +-
 .../olat/repository/RepositoryManager.java    | 26 +++++------
 .../user/AbstractUserPropertyHandler.java     |  8 ++--
 src/main/java/org/olat/user/UserImpl.hbm.xml  |  2 +-
 src/main/java/org/olat/user/UserImpl.java     | 16 ++++---
 .../java/org/olat/user/UserManagerImpl.java   | 43 ++++++++++---------
 src/main/resources/infinispan-config.xml      |  4 +-
 src/test/java/org/olat/user/UserTest.java     |  2 +-
 16 files changed, 89 insertions(+), 82 deletions(-)

diff --git a/pom.xml b/pom.xml
index 242d4c4823d..8125bc981af 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
 	<modelVersion>4.0.0</modelVersion>
 	<groupId>org.openolat</groupId>
 	<artifactId>openolat-lms</artifactId>
-	<version>9.3-SNAPSHOT</version>
+	<version>10.0-SNAPSHOT</version>
 	<packaging>war</packaging>
 	<name>OpenOLAT LMS</name>
 	<url>http://www.openolat.org</url>
@@ -64,13 +64,13 @@
 	<properties>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 		<targetJdk>1.7</targetJdk>
-		<org.springframework.version>3.2.4.RELEASE</org.springframework.version>
-		<org.hibernate.version>4.2.8.Final</org.hibernate.version>
+		<org.springframework.version>3.2.6.RELEASE</org.springframework.version>
+		<org.hibernate.version>4.3.0.Final</org.hibernate.version>
 		<com.sun.jersey.version>1.17.1</com.sun.jersey.version>
 		<jackson.version>1.9.2</jackson.version>
-		<org.mysql.version>5.1.26</org.mysql.version>
-		<org.postgresql.version>9.1-901.jdbc4</org.postgresql.version>
-		<org.infinispan.version>5.2.7.Final</org.infinispan.version>
+		<org.mysql.version>5.1.28</org.mysql.version>
+		<org.postgresql.version>9.3-1100-jdbc41</org.postgresql.version>
+		<org.infinispan.version>6.0.1.Final</org.infinispan.version>
 
 	    <!-- properties for testing and Q&A -->
 	    <!-- by default no tests are executed so far (April 2011). Use appropriate profiles and properties on the command line -->
@@ -339,7 +339,7 @@
 					<version>${org.mysql.version}</version>
 				</dependency>
 				<dependency>
-					<groupId>postgresql</groupId>
+					<groupId>org.postgresql</groupId>
 					<artifactId>postgresql</artifactId>
 					<version>${org.postgresql.version}</version>
 				</dependency>
@@ -526,7 +526,7 @@
 					<scope>provided</scope>
 				</dependency>
 				<dependency>
-					<groupId>postgresql</groupId>
+					<groupId>org.postgresql</groupId>
 					<artifactId>postgresql</artifactId>
 					<version>${org.postgresql.version}</version>
 					<scope>provided</scope>
@@ -595,7 +595,7 @@
 					<version>${org.mysql.version}</version>
 				</dependency>
 				<dependency>
-					<groupId>postgresql</groupId>
+					<groupId>org.postgresql</groupId>
 					<artifactId>postgresql</artifactId>
 					<version>${org.postgresql.version}</version>
 				</dependency>
diff --git a/src/main/java/org/olat/basesecurity/BaseSecurityManager.java b/src/main/java/org/olat/basesecurity/BaseSecurityManager.java
index f482b1f5d76..ff794b50c41 100644
--- a/src/main/java/org/olat/basesecurity/BaseSecurityManager.java
+++ b/src/main/java/org/olat/basesecurity/BaseSecurityManager.java
@@ -1242,7 +1242,7 @@ public class BaseSecurityManager extends BasicManager implements BaseSecurity {
 		StringBuilder sb = new StringBuilder();
 		sb.append("select identity from ").append(IdentityImpl.class.getName()).append(" identity ")
 			.append(" inner join identity.user user ")
-			.append(" where user.properties['").append(UserConstants.INSTITUTIONALUSERIDENTIFIER).append("'] in (:idNumbers) ");
+			.append(" where user.userProperties['").append(UserConstants.INSTITUTIONALUSERIDENTIFIER).append("'] in (:idNumbers) ");
 
 		return dbInstance.getCurrentEntityManager()
 				.createQuery(sb.toString(), Identity.class)
@@ -1547,9 +1547,14 @@ public class BaseSecurityManager extends BasicManager implements BaseSecurity {
 	public void deleteAuthentication(Authentication auth) {
 		if(auth == null || auth.getKey() == null) return;//nothing to do
 		try {
-			AuthenticationImpl authRef = dbInstance.getCurrentEntityManager()
-					.getReference(AuthenticationImpl.class, auth.getKey());
-			dbInstance.getCurrentEntityManager().remove(authRef);
+			StringBuilder sb = new StringBuilder();
+			sb.append("select auth from ").append(AuthenticationImpl.class.getName()).append(" as auth")
+			  .append(" where auth.key=:authKey");
+
+			AuthenticationImpl authRef = dbInstance.getCurrentEntityManager().find(AuthenticationImpl.class,  auth.getKey());
+			if(authRef != null) {
+				dbInstance.getCurrentEntityManager().remove(authRef);
+			}
 		} catch (EntityNotFoundException e) {
 			logError("", e);
 		}
@@ -1729,9 +1734,9 @@ public class BaseSecurityManager extends BasicManager implements BaseSecurity {
 						if (needsOr) sb.append(" or ");
 						//fxdiff
 						if(dbVendor.equals("mysql")) {
-							sb.append(" user.properties['").append(key).append("'] like :").append(key).append("_value ");
+							sb.append(" user.userProperties['").append(key).append("'] like :").append(key).append("_value ");
 						} else {
-							sb.append(" lower(user.properties['").append(key).append("']) like :").append(key).append("_value ");
+							sb.append(" lower(user.userProperties['").append(key).append("']) like :").append(key).append("_value ");
 						}
 						if(dbVendor.equals("oracle")) {
 							sb.append(" escape '\\'");
@@ -1747,9 +1752,9 @@ public class BaseSecurityManager extends BasicManager implements BaseSecurity {
 				for (String key : otherProperties.keySet()) {
 					needsUserPropertiesJoin = checkIntersectionInUserProperties(sb,needsUserPropertiesJoin, params.isUserPropertiesAsIntersectionSearch());
 					if(dbVendor.equals("mysql")) {
-						sb.append(" user.properties['").append(key).append("'] like :").append(key).append("_value ");
+						sb.append(" user.userProperties['").append(key).append("'] like :").append(key).append("_value ");
 					} else {
-						sb.append(" lower(user.properties['").append(key).append("']) like :").append(key).append("_value ");
+						sb.append(" lower(user.userProperties['").append(key).append("']) like :").append(key).append("_value ");
 					}
 					if(dbVendor.equals("oracle")) {
 						sb.append(" escape '\\'");
diff --git a/src/main/java/org/olat/core/commons/services/taskexecutor/manager/PersistentTaskDAO.java b/src/main/java/org/olat/core/commons/services/taskexecutor/manager/PersistentTaskDAO.java
index 81957dcfc00..3070ebd4d0c 100644
--- a/src/main/java/org/olat/core/commons/services/taskexecutor/manager/PersistentTaskDAO.java
+++ b/src/main/java/org/olat/core/commons/services/taskexecutor/manager/PersistentTaskDAO.java
@@ -207,7 +207,7 @@ public class PersistentTaskDAO {
 		PersistentTask reloadedTask = dbInstance.getCurrentEntityManager()
 				.find(PersistentTask.class, task.getKey(), LockModeType.PESSIMISTIC_WRITE);
 		dbInstance.getCurrentEntityManager()
-				.createNamedQuery("deleteTaskModifiersOf")
+				.createQuery("delete from extaskmodifier taskmod where taskmod.task.key=:taskKey")
 				.setParameter("taskKey", task.getKey())
 				.executeUpdate();
 		dbInstance.getCurrentEntityManager().remove(reloadedTask);
diff --git a/src/main/java/org/olat/core/commons/services/taskexecutor/model/PersistentTaskModifier.java b/src/main/java/org/olat/core/commons/services/taskexecutor/model/PersistentTaskModifier.java
index cceb0206401..864ee80b61d 100644
--- a/src/main/java/org/olat/core/commons/services/taskexecutor/model/PersistentTaskModifier.java
+++ b/src/main/java/org/olat/core/commons/services/taskexecutor/model/PersistentTaskModifier.java
@@ -50,8 +50,7 @@ import org.olat.core.id.Persistable;
 @Table(name="o_ex_task_modifier")
 @NamedQueries({
 	@NamedQuery(name="loadTaskModifierByKey", query="select taskmod from extaskmodifier taskmod where taskmod.key=:modifierKey"),
-	@NamedQuery(name="loadTaskModifiers", query="select distinct(taskmod.modifier) from extaskmodifier taskmod where taskmod.task.key=:taskKey"),
-	@NamedQuery(name="deleteTaskModifiersOf", query="delete from extaskmodifier taskmod where taskmod.task.key=:taskKey")
+	@NamedQuery(name="loadTaskModifiers", query="select distinct(taskmod.modifier) from extaskmodifier taskmod where taskmod.task.key=:taskKey")
 })
 public class PersistentTaskModifier implements CreateInfo, Persistable {
 
diff --git a/src/main/java/org/olat/group/manager/BusinessGroupDAO.java b/src/main/java/org/olat/group/manager/BusinessGroupDAO.java
index ce27fc36140..266afcd1bf9 100644
--- a/src/main/java/org/olat/group/manager/BusinessGroupDAO.java
+++ b/src/main/java/org/olat/group/manager/BusinessGroupDAO.java
@@ -1009,9 +1009,9 @@ public class BusinessGroupDAO {
 	
 	private StringBuilder searchLikeUserProperty(StringBuilder sb, String key, String var) {
 		if(dbInstance.getDbVendor().equals("mysql")) {
-			sb.append(" user.properties['").append(key).append("'] like :").append(var);
+			sb.append(" user.userProperties['").append(key).append("'] like :").append(var);
 		} else {
-			sb.append(" lower(user.properties['").append(key).append("']) like :").append(var);
+			sb.append(" lower(user.userProperties['").append(key).append("']) like :").append(var);
 			if(dbInstance.getDbVendor().equals("oracle")) {
 	 	 		sb.append(" escape '\\'");
 	 	 	}
diff --git a/src/main/java/org/olat/ims/qti/QTIResultManager.java b/src/main/java/org/olat/ims/qti/QTIResultManager.java
index edeb6d0bb0c..099ea36d5a4 100644
--- a/src/main/java/org/olat/ims/qti/QTIResultManager.java
+++ b/src/main/java/org/olat/ims/qti/QTIResultManager.java
@@ -136,7 +136,7 @@ public class QTIResultManager extends BasicManager implements UserDataDeletable
 		slct.append("and rset.repositoryRef=? ");
 		 // 1 -> iqtest, 2 -> iqself
 		if(type == 1 || type == 2)
-		    slct.append("order by usr.properties['").append(UserConstants.LASTNAME).append("'] , rset.assessmentID, res.itemIdent");
+		    slct.append("order by usr.userProperties['").append(UserConstants.LASTNAME).append("'] , rset.assessmentID, res.itemIdent");
 			//3 -> iqsurv: the alphabetical assortment above could destroy the anonymization
 	    // if names and quantity of the persons is well-known
 		else 
diff --git a/src/main/java/org/olat/instantMessaging/manager/InstantMessageDAO.java b/src/main/java/org/olat/instantMessaging/manager/InstantMessageDAO.java
index 07d5f3726ce..56d671b2007 100644
--- a/src/main/java/org/olat/instantMessaging/manager/InstantMessageDAO.java
+++ b/src/main/java/org/olat/instantMessaging/manager/InstantMessageDAO.java
@@ -92,7 +92,8 @@ public class InstantMessageDAO {
 	}
 	
 	public int deleteMessages(OLATResourceable ores) {
-		int count = dbInstance.getCurrentEntityManager().createNamedQuery("deleteIMessageByResource")
+		int count = dbInstance.getCurrentEntityManager()
+				.createQuery("delete from instantmessage msg where msg.resourceId=:resid and msg.resourceTypeName=:resname")
 				.setParameter("resid", ores.getResourceableId())
 				.setParameter("resname", ores.getResourceableTypeName())
 				.executeUpdate();
@@ -120,11 +121,12 @@ public class InstantMessageDAO {
 	}
 	
 	public void deleteNotification(Identity identity, OLATResourceable ores) {
-		dbInstance.getCurrentEntityManager().createNamedQuery("deleteIMNotificationByResourceAndIdentity")
-				.setParameter("identityKey", identity.getKey())
-				.setParameter("resid", ores.getResourceableId())
-				.setParameter("resname", ores.getResourceableTypeName())
-				.executeUpdate();
+		dbInstance.getCurrentEntityManager()
+			.createQuery("delete from imnotification notification where notification.toIdentityKey=:identityKey and notification.resourceId=:resid and notification.resourceTypeName=:resname")
+			.setParameter("identityKey", identity.getKey())
+			.setParameter("resid", ores.getResourceableId())
+			.setParameter("resname", ores.getResourceableTypeName())
+			.executeUpdate();
 	}
 	
 	public List<InstantMessageNotification> getNotifications(Identity identity) {
diff --git a/src/main/java/org/olat/instantMessaging/model/InstantMessageImpl.java b/src/main/java/org/olat/instantMessaging/model/InstantMessageImpl.java
index e103cf24702..7547225a963 100644
--- a/src/main/java/org/olat/instantMessaging/model/InstantMessageImpl.java
+++ b/src/main/java/org/olat/instantMessaging/model/InstantMessageImpl.java
@@ -48,8 +48,7 @@ import org.olat.instantMessaging.InstantMessage;
 @NamedQueries({
 	@NamedQuery(name="loadIMessageByKey",query="select msg from instantmessage msg  where msg.key=:key"),
 	@NamedQuery(name="loadIMessageByResource", query="select msg from instantmessage msg where msg.resourceId=:resid and msg.resourceTypeName=:resname order by msg.creationDate desc"),
-	@NamedQuery(name="loadIMessageByResourceAndDate", query="select msg from instantmessage msg where msg.resourceId=:resid and msg.resourceTypeName=:resname and msg.creationDate>=:from order by msg.creationDate desc"),
-	@NamedQuery(name="deleteIMessageByResource", query="delete from instantmessage msg where msg.resourceId=:resid and msg.resourceTypeName=:resname")
+	@NamedQuery(name="loadIMessageByResourceAndDate", query="select msg from instantmessage msg where msg.resourceId=:resid and msg.resourceTypeName=:resname and msg.creationDate>=:from order by msg.creationDate desc")
 })
 public class InstantMessageImpl implements InstantMessage, Persistable, CreateInfo {
 	
diff --git a/src/main/java/org/olat/instantMessaging/model/InstantMessageNotificationImpl.java b/src/main/java/org/olat/instantMessaging/model/InstantMessageNotificationImpl.java
index d237626fc30..b1aa6ab3b32 100644
--- a/src/main/java/org/olat/instantMessaging/model/InstantMessageNotificationImpl.java
+++ b/src/main/java/org/olat/instantMessaging/model/InstantMessageNotificationImpl.java
@@ -47,8 +47,7 @@ import org.olat.instantMessaging.InstantMessageNotification;
 @Entity(name="imnotification")
 @Table(name="o_im_notification")
 @NamedQueries({
-		@NamedQuery(name="loadIMNotificationByIdentity", query="select notification from imnotification notification where notification.toIdentityKey=:identityKey order by notification.creationDate desc"),
-		@NamedQuery(name="deleteIMNotificationByResourceAndIdentity", query="delete from imnotification notification where notification.toIdentityKey=:identityKey and notification.resourceId=:resid and notification.resourceTypeName=:resname")
+		@NamedQuery(name="loadIMNotificationByIdentity", query="select notification from imnotification notification where notification.toIdentityKey=:identityKey order by notification.creationDate desc")
 })
 public class InstantMessageNotificationImpl implements InstantMessageNotification, Persistable, CreateInfo  {
 
diff --git a/src/main/java/org/olat/repository/RepositoryManager.java b/src/main/java/org/olat/repository/RepositoryManager.java
index 2af2d2c0731..e9c2987e455 100644
--- a/src/main/java/org/olat/repository/RepositoryManager.java
+++ b/src/main/java/org/olat/repository/RepositoryManager.java
@@ -1068,7 +1068,7 @@ public class RepositoryManager extends BasicManager {
 					+ " where sgmsi.securityGroup = v.ownerGroup"
 					+ " and sgmsi.identity = identity"
 					+ " and identity.user = user"
-					+" and user.properties['institutionalName']= :institutionCourseManager "
+					+" and user.userProperties['institutionalName']= :institutionCourseManager "
 					+ " and res.resName= :restrictedType and v.access = 1");
 			
 			DBQuery dbquery = DBFactory.getInstance().createQuery(query.toString());
@@ -1259,10 +1259,10 @@ public class RepositoryManager extends BasicManager {
 		if (author != null) { // fuzzy author search
 			author = author.replace('*','%');
 			author = '%' + author + '%';
-			query.append(" and (sgmsi2.securityGroup = v.ownerGroup and "+
-			"sgmsi2.identity = identity and "+
-			"identity.user = user and "+
-			"(user.properties['firstName'] like :author or user.properties['lastName'] like :author or identity.name like :author))");
+			query.append(" and (sgmsi2.securityGroup = v.ownerGroup and ")
+			     .append("sgmsi2.identity = identity and ")
+			     .append("identity.user = user and ")
+			     .append("(user.userProperties['firstName'] like :author or user.userProperties['lastName'] like :author or identity.name like :author))");
 		}
 		// restrict on resource name
 		if (displayName != null) {
@@ -1382,9 +1382,9 @@ public class RepositoryManager extends BasicManager {
 			if (!isFirstOfWhereClause) query.append(" and ");
 			query.append("sgmsi.securityGroup = v.ownerGroup and sgmsi.identity = identity and identity.user = user and ");
 			if(mysql) {
-				query.append("(user.properties['firstName'] like :author or user.properties['lastName'] like :author or identity.name like :author)");
+				query.append("(user.userProperties['firstName'] like :author or user.userProperties['lastName'] like :author or identity.name like :author)");
 			} else {
-				query.append("(lower(user.properties['firstName']) like lower(:author) or lower(user.properties['lastName']) like lower(:author) or lower(identity.name) like lower(:author))");
+				query.append("(lower(user.userProperties['firstName']) like lower(:author) or lower(user.userProperties['lastName']) like lower(:author) or lower(identity.name) like lower(:author))");
 			}
 			isFirstOfWhereClause = false;
 		}
@@ -1603,7 +1603,7 @@ public class RepositoryManager extends BasicManager {
 				query.append("sgmsi.securityGroup = v.ownerGroup and " 
 						+ "sgmsi.identity = identity and " 
 						+ "identity.user = user and " 
-						+ "(user.properties['firstName'] like :author or user.properties['lastName'] like :author or identity.name like :author)");
+						+ "(user.userProperties['firstName'] like :author or user.userProperties['lastName'] like :author or identity.name like :author)");
 				isFirstOfWhereClause = false;
 			}
 			if (var_displayname) {
@@ -1627,7 +1627,7 @@ public class RepositoryManager extends BasicManager {
 			}
 			
 			if (!isFirstOfWhereClause) query.append(" and ");
-			query.append("v.access = 1 and user.properties['institutionalName']= :institution ");
+			query.append("v.access = 1 and user.userProperties['institutionalName']= :institution ");
 			isFirstOfWhereClause = false;
 			
 			DBQuery dbQuery = DBFactory.getInstance().createQuery(query.toString());
@@ -1739,7 +1739,7 @@ public class RepositoryManager extends BasicManager {
 			     .append(" org.olat.basesecurity.IdentityImpl msid,")
 			     .append(" org.olat.user.UserImpl msuser ")
 			     .append(" where ms.identity = msid and msid.user = msuser and ")
-			     .append(" msuser.properties['institutionalName']=:institution)")
+			     .append(" msuser.userProperties['institutionalName']=:institution)")
 			     .append("))");
 		} else if (params.isOnlyExplicitMember()) {
 			query.append(" where ");
@@ -1760,7 +1760,7 @@ public class RepositoryManager extends BasicManager {
 		         .append(" org.olat.basesecurity.IdentityImpl msauthid,")
 		         .append(" org.olat.user.UserImpl msauthuser ")
 		         .append(" where msauth.identity = msauthid and msauthid.user = msauthuser and ")
-		         .append(" (msauthuser.properties['firstName'] like :author or msauthuser.properties['lastName'] like :author or msauthid.name like :author))");
+		         .append(" (msauthuser.userProperties['firstName'] like :author or msauthuser.userProperties['lastName'] like :author or msauthid.name like :author))");
 			*/
 			author = PersistenceHelper.makeFuzzyQueryString(author);
 			query.append(" and ownerGroup in (select msauth.securityGroup from ").append(SecurityGroupMembershipImpl.class.getName()).append(" msauth, ")
@@ -1769,9 +1769,9 @@ public class RepositoryManager extends BasicManager {
            .append(" where msauth.identity = msauthid and msauthid.user = msauthuser and ")
            .append(" (");
 			
-			PersistenceHelper.appendFuzzyLike(query, "msauthuser.properties['firstName']", "author", dbInstance.getDbVendor());
+			PersistenceHelper.appendFuzzyLike(query, "msauthuser.userProperties['firstName']", "author", dbInstance.getDbVendor());
 			query.append(" or ");
-			PersistenceHelper.appendFuzzyLike(query, "msauthuser.properties['lastName']", "author", dbInstance.getDbVendor());
+			PersistenceHelper.appendFuzzyLike(query, "msauthuser.userProperties['lastName']", "author", dbInstance.getDbVendor());
 			query.append(" or ");
 			PersistenceHelper.appendFuzzyLike(query, "msauthid.name", "author", dbInstance.getDbVendor());
     
diff --git a/src/main/java/org/olat/user/AbstractUserPropertyHandler.java b/src/main/java/org/olat/user/AbstractUserPropertyHandler.java
index 12eb99a143d..896bd3a80bc 100644
--- a/src/main/java/org/olat/user/AbstractUserPropertyHandler.java
+++ b/src/main/java/org/olat/user/AbstractUserPropertyHandler.java
@@ -122,7 +122,7 @@ public abstract class AbstractUserPropertyHandler implements UserPropertyHandler
 	 */
 	protected String getInternalValue(User user) {
 		if (user instanceof UserImpl) {
-			String value = ((UserImpl)user).getProperties().get(name);
+			String value = ((UserImpl)user).getUserProperties().get(name);
 			if("_".equals(value) && "oracle".equals(DBFactory.getInstance().getDbVendor())) {
 				value = null;
 			}
@@ -143,12 +143,12 @@ public abstract class AbstractUserPropertyHandler implements UserPropertyHandler
 			if (value == null || value.length() == 0) {
 				//fxdiff: store each value
 				if("oracle".equals(DBFactory.getInstance().getDbVendor())) {
-					((UserImpl)user).getProperties().put(name, "_");
+					((UserImpl)user).getUserProperties().put(name, "_");
 				} else {
-					((UserImpl)user).getProperties().put(name, "");
+					((UserImpl)user).getUserProperties().put(name, "");
 				}
 			} else {
-				((UserImpl)user).getProperties().put(name, value);
+				((UserImpl)user).getUserProperties().put(name, value);
 			}
 		} else if (user instanceof UserImpl) {
 			user.setProperty(name, value);
diff --git a/src/main/java/org/olat/user/UserImpl.hbm.xml b/src/main/java/org/olat/user/UserImpl.hbm.xml
index 114788ad224..d829dacb522 100644
--- a/src/main/java/org/olat/user/UserImpl.hbm.xml
+++ b/src/main/java/org/olat/user/UserImpl.hbm.xml
@@ -27,7 +27,7 @@
 	    <property name="receiveRealMail" column="receiverealmail" unique="false" not-null="false" length="16" type="string"/>  
     </component>
 
-	<map name="properties" table="o_userproperty" cascade="all,delete-orphan" fetch="join">
+	<map name="userProperties" table="o_userproperty" cascade="all,delete-orphan" fetch="join">
         <key column="fk_user_id" not-null="true"/>
         <map-key column="propname" type="string"/>
         <element column="propvalue" type="string"/>
diff --git a/src/main/java/org/olat/user/UserImpl.java b/src/main/java/org/olat/user/UserImpl.java
index 5848586e584..4cfbfb09c5d 100644
--- a/src/main/java/org/olat/user/UserImpl.java
+++ b/src/main/java/org/olat/user/UserImpl.java
@@ -53,7 +53,9 @@ import org.olat.user.propertyhandlers.UserPropertyHandler;
  * @author Florian Gnägi
  */
 public class UserImpl extends PersistentObject implements User {
-	
+
+	private static final long serialVersionUID = -2872102058369727753L;
+
 	private Preferences preferences;
 	
 	// o_clusterOK by:cg add diInSync in ChangeProfileController and notifiy about change via event-bus
@@ -77,9 +79,9 @@ public class UserImpl extends PersistentObject implements User {
 
 	UserImpl(String firstName, String lastName, String eMail) {
 		super();
-		if (firstName != null) getProperties().put(UserConstants.FIRSTNAME, firstName);
-		if (lastName != null) getProperties().put(UserConstants.LASTNAME, lastName);
-		if (eMail != null) getProperties().put(UserConstants.EMAIL, eMail);
+		if (firstName != null) getUserProperties().put(UserConstants.FIRSTNAME, firstName);
+		if (lastName != null) getUserProperties().put(UserConstants.LASTNAME, lastName);
+		if (eMail != null) getUserProperties().put(UserConstants.EMAIL, eMail);
 		this.preferences = new PreferencesImpl();
 	}
 
@@ -140,8 +142,8 @@ public class UserImpl extends PersistentObject implements User {
 	 * 
 	 * @return Map containing the raw properties data
 	 */
-	Map<String, String> getProperties() {
-		if (properties == null) setProperties(new HashMap<String, String>());
+	Map<String, String> getUserProperties() {
+		if (properties == null) setUserProperties(new HashMap<String, String>());
 		return properties;
 	}
 
@@ -149,7 +151,7 @@ public class UserImpl extends PersistentObject implements User {
 	 * Hibernate setter
 	 * @param fields
 	 */
-	private void setProperties(Map<String, String> fields) {
+	private void setUserProperties(Map<String, String> fields) {
 		this.properties = fields;
 	}
 
diff --git a/src/main/java/org/olat/user/UserManagerImpl.java b/src/main/java/org/olat/user/UserManagerImpl.java
index 72679ab6343..8f2259b4478 100644
--- a/src/main/java/org/olat/user/UserManagerImpl.java
+++ b/src/main/java/org/olat/user/UserManagerImpl.java
@@ -133,9 +133,9 @@ public class UserManagerImpl extends UserManager {
 		for(String emailProperty:emailProperties) {
 			StringBuilder sb = new StringBuilder();
 			sb.append("select count(user) from org.olat.core.id.User user where ")
-				.append("user.properties['")
-				.append(emailProperty)
-				.append("']=:email_value");
+			  .append("user.userProperties['")
+			  .append(emailProperty)
+			  .append("']=:email_value");
 			
 			String query = sb.toString();
 			DBQuery dbq = db.createQuery(query);
@@ -150,20 +150,21 @@ public class UserManagerImpl extends UserManager {
 	
 	@Override
 	public List<Long> findUserKeyWithProperty(String propName, String propValue) {
-		StringBuilder sb = new StringBuilder("select user.key from ").append(UserImpl.class.getName()).append(" user ")
-			.append(" where user.properties['").append(propName).append("'] =:propValue");
+		StringBuilder sb = new StringBuilder();
+		sb.append("select user.key from ").append(UserImpl.class.getName()).append(" user ")
+		  .append(" where user.userProperties['").append(propName).append("'] =:propValue");
 
-		List<Long> userKeys = dbInstance.getCurrentEntityManager()
+		return dbInstance.getCurrentEntityManager()
 				.createQuery(sb.toString(), Long.class)
-				.setParameter("propValue", propValue).getResultList();
-		return userKeys;
+				.setParameter("propValue", propValue)
+				.getResultList();
 	}
 	
 	@Override
 	public Identity findIdentityKeyWithProperty(String propName, String propValue) {
 		StringBuilder sb = new StringBuilder("select identity from ").append(IdentityImpl.class.getName()).append(" identity ")
 			.append(" inner join identity.user user ")
-			.append(" where user.properties['").append(propName).append("'] =:propValue");
+			.append(" where user.userProperties['").append(propName).append("'] =:propValue");
 
 		List<Identity> userKeys = dbInstance.getCurrentEntityManager()
 				.createQuery(sb.toString(), Identity.class)
@@ -190,9 +191,9 @@ public class UserManagerImpl extends UserManager {
 		//search email
 		StringBuilder emailSb = new StringBuilder(sb);
 		if(mysql) {
-			emailSb.append(" user.properties['").append(UserConstants.EMAIL).append("'] =:email");
+			emailSb.append(" user.userProperties['").append(UserConstants.EMAIL).append("'] =:email");
 		} else {
-			emailSb.append(" lower(user.properties['").append(UserConstants.EMAIL).append("']) = lower(:email)");
+			emailSb.append(" lower(user.userProperties['").append(UserConstants.EMAIL).append("']) = lower(:email)");
 		}
 
 		List<Identity> identities = dbInstance.getCurrentEntityManager()
@@ -205,9 +206,9 @@ public class UserManagerImpl extends UserManager {
 		//search institutional email
 		StringBuilder institutionalSb = new StringBuilder(sb);
 		if(mysql) {
-			institutionalSb.append(" user.properties['").append(UserConstants.INSTITUTIONALEMAIL).append("'] =:email");
+			institutionalSb.append(" user.userProperties['").append(UserConstants.INSTITUTIONALEMAIL).append("'] =:email");
 		} else {
-			institutionalSb.append(" lower(user.properties['").append(UserConstants.INSTITUTIONALEMAIL).append("']) = lower(:email)");
+			institutionalSb.append(" lower(user.userProperties['").append(UserConstants.INSTITUTIONALEMAIL).append("']) = lower(:email)");
 		}
 		List<Identity> instIdentities = dbInstance.getCurrentEntityManager()
 				.createQuery(institutionalSb.toString(), Identity.class)
@@ -254,9 +255,9 @@ public class UserManagerImpl extends UserManager {
 		//search email
 		StringBuilder emailSb = new StringBuilder(sb);
 		if(mysql) {
-			emailSb.append(" user.properties['").append(UserConstants.EMAIL).append("']  in (:emails) ");
+			emailSb.append(" user.userProperties['").append(UserConstants.EMAIL).append("']  in (:emails) ");
 		} else {
-			emailSb.append(" lower(user.properties['").append(UserConstants.EMAIL).append("']) in (:emails)");
+			emailSb.append(" lower(user.userProperties['").append(UserConstants.EMAIL).append("']) in (:emails)");
 		}
 
 		List<Identity> identities = dbInstance.getCurrentEntityManager()
@@ -266,9 +267,9 @@ public class UserManagerImpl extends UserManager {
 		//search institutional email
 		StringBuilder institutionalSb = new StringBuilder(sb);
 		if(mysql) {
-			institutionalSb.append(" user.properties['").append(UserConstants.INSTITUTIONALEMAIL).append("'] in (:emails) ");
+			institutionalSb.append(" user.userProperties['").append(UserConstants.INSTITUTIONALEMAIL).append("'] in (:emails) ");
 		} else {
-			institutionalSb.append(" lower(user.properties['").append(UserConstants.INSTITUTIONALEMAIL).append("']) in (:emails)");
+			institutionalSb.append(" lower(user.userProperties['").append(UserConstants.INSTITUTIONALEMAIL).append("']) in (:emails)");
 		}
 		if(!identities.isEmpty()) {
 			institutionalSb.append(" and identity not in (:identities) ");
@@ -309,9 +310,9 @@ public class UserManagerImpl extends UserManager {
 		//search email
 		StringBuilder emailSb = new StringBuilder(sb);
 		if(mysql) {
-			emailSb.append(" user.properties['").append(UserConstants.EMAIL).append("'] =:email");
+			emailSb.append(" user.userProperties['").append(UserConstants.EMAIL).append("'] =:email");
 		} else {
-			emailSb.append(" lower(user.properties['").append(UserConstants.EMAIL).append("']) = lower(:email)");
+			emailSb.append(" lower(user.userProperties['").append(UserConstants.EMAIL).append("']) = lower(:email)");
 		}
 		
 		Number count = dbInstance.getCurrentEntityManager()
@@ -325,9 +326,9 @@ public class UserManagerImpl extends UserManager {
 		//search institutional email
 		StringBuilder institutionalSb = new StringBuilder(sb);
 		if(mysql) {
-			institutionalSb.append(" user.properties['").append(UserConstants.INSTITUTIONALEMAIL).append("'] =:email");
+			institutionalSb.append(" user.userProperties['").append(UserConstants.INSTITUTIONALEMAIL).append("'] =:email");
 		} else {
-			institutionalSb.append(" lower(user.properties['").append(UserConstants.INSTITUTIONALEMAIL).append("']) = lower(:email)");
+			institutionalSb.append(" lower(user.userProperties['").append(UserConstants.INSTITUTIONALEMAIL).append("']) = lower(:email)");
 		}
 		count = dbInstance.getCurrentEntityManager()
 				.createQuery(institutionalSb.toString(), Number.class)
diff --git a/src/main/resources/infinispan-config.xml b/src/main/resources/infinispan-config.xml
index d1f1d3e1bdc..bfc590e795a 100644
--- a/src/main/resources/infinispan-config.xml
+++ b/src/main/resources/infinispan-config.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xmlns="urn:infinispan:config:5.1"
-            xsi:schemaLocation="urn:infinispan:config:5.1 http://www.infinispan.org/schemas/infinispan-config-5.1.xsd">
+            xmlns="urn:infinispan:config:6.0"
+            xsi:schemaLocation="urn:infinispan:config:6.0 http://www.infinispan.org/schemas/infinispan-config-6.0.xsd">
    <global>
       <globalJmxStatistics allowDuplicateDomains="true" />
    </global>
diff --git a/src/test/java/org/olat/user/UserTest.java b/src/test/java/org/olat/user/UserTest.java
index c1ac2c6b2bd..76dd795c473 100644
--- a/src/test/java/org/olat/user/UserTest.java
+++ b/src/test/java/org/olat/user/UserTest.java
@@ -423,7 +423,7 @@ public class UserTest extends OlatTestCase {
 		slct.append("org.olat.user.UserImpl usr ");
 		slct.append("where ");
 		slct.append("identity.user = usr.key ");
-		slct.append("order by usr.properties['firstName'] desc");
+		slct.append("order by usr.userProperties['firstName'] desc");
 		List<Identity> results = db.find(slct.toString());
 		Identity ident1 = (Identity) results.get(0);
 		Identity ident2 = (Identity) results.get(1);
-- 
GitLab