Commit 078b99e4 by Tuukka Kivilahti

one bug and maybe not so much that info, plz

1 parent 9366fc3c
...@@ -5,10 +5,7 @@ ...@@ -5,10 +5,7 @@
<persistence-unit name="MoyaDb"> <persistence-unit name="MoyaDb">
<jta-data-source>jdbc/moyaDb</jta-data-source> <jta-data-source>jdbc/moyaDb</jta-data-source>
<properties> <properties>
<property name="eclipselink.ddl-generation" value="create-tables" />
<property name="eclipselink.cache.size.default" value="16384" /> <property name="eclipselink.cache.size.default" value="16384" />
<property name="eclipselink.ddl-generation.output-mode"
value="sql-script" />
<property name="eclipselink.logging.logger" value="ServerLogger" /> <property name="eclipselink.logging.logger" value="ServerLogger" />
<property name="eclipselink.jdbc.uppercase-columns" value="false" /> <property name="eclipselink.jdbc.uppercase-columns" value="false" />
<property name="eclipselink.target-database" <property name="eclipselink.target-database"
...@@ -18,6 +15,7 @@ ...@@ -18,6 +15,7 @@
<property name="eclipselink.target-server" value="Glassfish" /> <property name="eclipselink.target-server" value="Glassfish" />
<property name="eclipselink.session.customizer" <property name="eclipselink.session.customizer"
value="fi.codecrew.moya.database.eclipselink.MoyaSessionCustomizer" /> value="fi.codecrew.moya.database.eclipselink.MoyaSessionCustomizer" />
<property name="eclipselink.ddl-generation" value="none"/>
</properties> </properties>
</persistence-unit> </persistence-unit>
......
...@@ -184,8 +184,8 @@ public class Lecture extends GenericEntity { ...@@ -184,8 +184,8 @@ public class Lecture extends GenericEntity {
newLecture.setName(getName()); newLecture.setName(getName());
newLecture.setHours(getHours()); newLecture.setHours(getHours());
newLecture.setMaxParticipantsCount(getMaxParticipantsCount()); newLecture.setMaxParticipantsCount(getMaxParticipantsCount());
newLecture.setStartTime(getStartTime()); newLecture.setStartTime( (Calendar) getStartTime().clone());
newLecture.setOpenForRoles(getOpenForRoles()); newLecture.setOpenForRoles(new ArrayList<Role>(getOpenForRoles()));
return newLecture; return newLecture;
} }
......
...@@ -21,7 +21,7 @@ public class JsonAttributeConverter implements AttributeConverter<JsonObject, PG ...@@ -21,7 +21,7 @@ public class JsonAttributeConverter implements AttributeConverter<JsonObject, PG
* JsonObject -> PGobject * JsonObject -> PGobject
*/ */
public PGobject convertToDatabaseColumn(JsonObject jsonObject) { public PGobject convertToDatabaseColumn(JsonObject jsonObject) {
log.info("Converting JsonObject to PGobject. Original JsonObject: {}", jsonObject); //log.info("Converting JsonObject to PGobject. Original JsonObject: {}", jsonObject);
PGobject pgObject = new PGobject(); PGobject pgObject = new PGobject();
pgObject.setType("json"); pgObject.setType("json");
...@@ -34,7 +34,7 @@ public class JsonAttributeConverter implements AttributeConverter<JsonObject, PG ...@@ -34,7 +34,7 @@ public class JsonAttributeConverter implements AttributeConverter<JsonObject, PG
} catch (SQLException e) { } catch (SQLException e) {
log.warn("PGobject.setValue() threw an exception. Should not happen. Something is wrong.", e); log.warn("PGobject.setValue() threw an exception. Should not happen. Something is wrong.", e);
} }
log.info("Converted JsonObject to PGobject: {}", pgObject); // log.info("Converted JsonObject to PGobject: {}", pgObject);
return pgObject; return pgObject;
} }
...@@ -42,11 +42,11 @@ public class JsonAttributeConverter implements AttributeConverter<JsonObject, PG ...@@ -42,11 +42,11 @@ public class JsonAttributeConverter implements AttributeConverter<JsonObject, PG
* PGobject -> JsonObject * PGobject -> JsonObject
*/ */
public JsonObject convertToEntityAttribute(PGobject pgObject) { public JsonObject convertToEntityAttribute(PGobject pgObject) {
log.info("Converting PGobject to JsonObject. Original PGobject: {}", pgObject); // log.info("Converting PGobject to JsonObject. Original PGobject: {}", pgObject);
// Convert null values to empty object // Convert null values to empty object
if (pgObject == null) { if (pgObject == null) {
log.info("PGobject was null. Retruning an empty JsonObject."); // log.info("PGobject was null. Retruning an empty JsonObject.");
return Json.createObjectBuilder().build(); return Json.createObjectBuilder().build();
} }
...@@ -63,7 +63,7 @@ public class JsonAttributeConverter implements AttributeConverter<JsonObject, PG ...@@ -63,7 +63,7 @@ public class JsonAttributeConverter implements AttributeConverter<JsonObject, PG
if (stringValue != null && !stringValue.toLowerCase().equals("null")) { if (stringValue != null && !stringValue.toLowerCase().equals("null")) {
JsonReader jsonReader = Json.createReader(new StringReader(stringValue)); JsonReader jsonReader = Json.createReader(new StringReader(stringValue));
JsonObject jsonObject = jsonReader.readObject(); JsonObject jsonObject = jsonReader.readObject();
log.info("Converted PGobject to JsonObject: {}", jsonObject); // log.info("Converted PGobject to JsonObject: {}", jsonObject);
return jsonObject; return jsonObject;
} else { } else {
log.info("Null value. Returning empty JsonObject"); log.info("Null value. Returning empty JsonObject");
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!