Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Codecrew
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
30
Merge Requests
2
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 078b99e4
authored
Jun 18, 2014
by
Tuukka Kivilahti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
one bug and maybe not so much that info, plz
1 parent
9366fc3c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
10 deletions
code/MoyaDatabase/src/META-INF/persistence.xml
code/MoyaDatabase/src/fi/codecrew/moya/model/Lecture.java
code/MoyaDatabase/src/fi/codecrew/moya/model/converters/JsonAttributeConverter.java
code/MoyaDatabase/src/META-INF/persistence.xml
View file @
078b99e
...
...
@@ -5,10 +5,7 @@
<persistence-unit
name=
"MoyaDb"
>
<jta-data-source>
jdbc/moyaDb
</jta-data-source>
<properties>
<property
name=
"eclipselink.ddl-generation"
value=
"create-tables"
/>
<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.jdbc.uppercase-columns"
value=
"false"
/>
<property
name=
"eclipselink.target-database"
...
...
@@ -18,6 +15,7 @@
<property
name=
"eclipselink.target-server"
value=
"Glassfish"
/>
<property
name=
"eclipselink.session.customizer"
value=
"fi.codecrew.moya.database.eclipselink.MoyaSessionCustomizer"
/>
<property
name=
"eclipselink.ddl-generation"
value=
"none"
/>
</properties>
</persistence-unit>
...
...
code/MoyaDatabase/src/fi/codecrew/moya/model/Lecture.java
View file @
078b99e
...
...
@@ -184,8 +184,8 @@ public class Lecture extends GenericEntity {
newLecture
.
setName
(
getName
());
newLecture
.
setHours
(
getHours
());
newLecture
.
setMaxParticipantsCount
(
getMaxParticipantsCount
());
newLecture
.
setStartTime
(
getStartTim
e
());
newLecture
.
setOpenForRoles
(
getOpenForRoles
(
));
newLecture
.
setStartTime
(
(
Calendar
)
getStartTime
().
clon
e
());
newLecture
.
setOpenForRoles
(
new
ArrayList
<
Role
>(
getOpenForRoles
()
));
return
newLecture
;
}
...
...
code/MoyaDatabase/src/fi/codecrew/moya/model/converters/JsonAttributeConverter.java
View file @
078b99e
...
...
@@ -21,7 +21,7 @@ public class JsonAttributeConverter implements AttributeConverter<JsonObject, PG
* JsonObject -> PGobject
*/
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
.
setType
(
"json"
);
...
...
@@ -34,7 +34,7 @@ public class JsonAttributeConverter implements AttributeConverter<JsonObject, PG
}
catch
(
SQLException
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
;
}
...
...
@@ -42,11 +42,11 @@ public class JsonAttributeConverter implements AttributeConverter<JsonObject, PG
* PGobject -> JsonObject
*/
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
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
();
}
...
...
@@ -63,7 +63,7 @@ public class JsonAttributeConverter implements AttributeConverter<JsonObject, PG
if
(
stringValue
!=
null
&&
!
stringValue
.
toLowerCase
().
equals
(
"null"
))
{
JsonReader
jsonReader
=
Json
.
createReader
(
new
StringReader
(
stringValue
));
JsonObject
jsonObject
=
jsonReader
.
readObject
();
log
.
info
(
"Converted PGobject to JsonObject: {}"
,
jsonObject
);
//
log.info("Converted PGobject to JsonObject: {}", jsonObject);
return
jsonObject
;
}
else
{
log
.
info
(
"Null value. Returning empty JsonObject"
);
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment