Skip to content

Commit

Permalink
fix bug: IllegalStateException of "User defined ID should be populate…
Browse files Browse the repository at this point in the history
…d before persist" when saving a subtype model with @id fields defined
  • Loading branch information
greenlaw110 committed Jul 14, 2011
1 parent 8821e5a commit 98a278b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.textile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Updates in 1.2.1beta6
* Fix bug: IllegalStateException of "User defined ID should be populated before persist" when saving a subtype model with @Id fields defined in parent type

Updates in 1.2.1beta5
* Add disableValidation() to Model. This is useful when your different subtype model have different fields
* Add @NoId annotation. This help to resolve issue discussed in https://groups.google.com/forum/#!topic/play-framework/hPWJCvefPoI/discussion
Expand Down
3 changes: 3 additions & 0 deletions documentation/manual/home.textile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Updates in 1.2.1beta6
* Fix bug: IllegalStateException of "User defined ID should be populated before persist" when saving a subtype model with @Id fields defined in parent type

Updates in 1.2.1beta5
* Add disableValidation() to Model. This is useful when your different subtype model have different fields
* Add @NoId annotation. This help to resolve issue discussed in https://groups.google.com/forum/#!topic/play-framework/hPWJCvefPoI/discussion
Expand Down
Binary file modified lib/play-morphia.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion src/play/modules/morphia/MorphiaEnhancer.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private void enhance_(CtClass ctClass, ApplicationClass applicationClass, boolea
}
// setId - for user marked Id entity, setId method needs to be override

CtMethod isUserDefinedId = CtMethod.make("protected boolean isUserDefinedId_() {return true;}", ctClass);
CtMethod isUserDefinedId = CtMethod.make("protected boolean isUserDefinedId_() {return super.isUserDefinedId_();}", ctClass);
ctClass.addMethod(isUserDefinedId);

} else {
Expand Down
4 changes: 2 additions & 2 deletions src/play/modules/morphia/MorphiaPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
* @author greenlaw110@gmail.com
*/
public class MorphiaPlugin extends PlayPlugin {
public static final String VERSION = "1.2.1beta5";
public static final String VERSION = "1.2.1beta6";

private static String msg_(String msg, Object... args) {
return String.format("MorphiaPlugin-" + VERSION + "> %1$s",
Expand Down Expand Up @@ -124,7 +124,7 @@ public void onConfigurationRead() {
Logger.trace("MongoDB host: %1$s", host);
Logger.trace("MongoDB port: %1$s", port);
} catch (UnknownHostException e) {
throw new RuntimeException(e.getMessage());
throw new RuntimeException("unknown db host: " + e.getMessage());
}
String dbName = c.getProperty(PREFIX + "name");
if (null == dbName) {
Expand Down

0 comments on commit 98a278b

Please sign in to comment.