Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not use package like xxx.model.yyy.model.ZzzModel #34

Closed
GoogleCodeExporter opened this issue Sep 2, 2015 · 8 comments
Closed

Can not use package like xxx.model.yyy.model.ZzzModel #34

GoogleCodeExporter opened this issue Sep 2, 2015 · 8 comments

Comments

@GoogleCodeExporter
Copy link

The partial stack trace is below:

java.lang.IllegalArgumentException: The meta data of the 
model(xxx.model.yyy.model.ZzzModel) is not found.
    at org.slim3.datastore.DatastoreUtil.createModelMeta(DatastoreUtil.java:1468)
    at org.slim3.datastore.DatastoreUtil.getModelMeta(DatastoreUtil.java:1395)
    at org.slim3.datastore.Datastore.getModelMeta(Datastore.java:2699)
    at org.slim3.datastore.Datastore.allocateId(Datastore.java:155)

The corresponding source code is:

            String metaClassName =
                modelClass.getName().replace(".model.", ".meta.").replace(
                    ".shared.",
                    ".server.")
                    + "Meta";

The sematics of the line is the first occurrence of ".model." will be replaced 
by ".meta.". But the slim3gen convention is the LAST occurrence of ".model." is 
replaced. So there is a inconsistency between the codegen tools and runtime 
library.

Original issue reported on code.google.com by mylee...@gmail.com on 18 Jun 2010 at 10:00

@GoogleCodeExporter
Copy link
Author

Original comment by higaya...@gmail.com on 18 Jun 2010 at 10:10

  • Changed state: Accepted
  • Added labels: Version-1.0.5
  • Removed labels: Version

@GoogleCodeExporter
Copy link
Author

Original comment by higaya...@gmail.com on 18 Jun 2010 at 11:37

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

The Rev#r1292 seems to have DatastoreUtil#replacePackageName and 
ModelMetaClassName#replacePackageName both replace the FIRST occurrence of 
".model." with ".meta.". The meta of xxx.model.yyy.model.ZzzModel will be 
xxx.meta.yyy.model.ZzzModel. Am I right? Is there any special design 
consideration? 

Isn't it more intuitive that the meta of xxx.model.yyy.model.ZzzModel becomes 
xxx.model.yyy.meta.ZzzModelMeta ?

Original comment by mylee...@gmail.com on 18 Jun 2010 at 1:23

@GoogleCodeExporter
Copy link
Author

Correct a mistake in the previous comment.

> The meta of xxx.model.yyy.model.ZzzModel will be xxx.meta.yyy.model.ZzzModel
The meta of xxx.model.yyy.model.ZzzModel will be xxx.meta.yyy.model.ZzzModelMeta

Original comment by mylee...@gmail.com on 18 Jun 2010 at 1:32

@GoogleCodeExporter
Copy link
Author

> The meta of xxx.model.yyy.model.ZzzModel will be 
xxx.meta.yyy.model.ZzzModelMeta.
> Am I right?

Yes you are.

> Is there any special design consideration?

It's just rule, no special design consideration.

> Isn't it more intuitive that the meta of xxx.model.yyy.model.ZzzModel becomes
> xxx.model.yyy.meta.ZzzModelMeta ?

What kind of rule do you recommend?

Original comment by higaya...@gmail.com on 18 Jun 2010 at 10:49

@GoogleCodeExporter
Copy link
Author

Some of the names of packages in our project are <project.root>.controller, 
<project.root>.dao, <project.root>.dao.impl, <project.root>.model, etc.

We put the corresponding slim3 implementation classes into the slim3 
subpackages listed below.

<project.root>.controller.slim3
<project.root>.dao.impl.slim3
<project.root>.model.slim3

If some other framework (for example, twig) is used, the subpackage names will 
be changed (from slim3 to twig) accordingly. 

The original slim3gen convention demands that we put model classes into 
<project.root>.model.slim3.model subpackage and the generated meta classes in 
<project.root>.model.slim3.meta. The original slim3gen rule and  and our 
package hierarchy are very intuitive.

The Rev#r1292 fix will put the meta classes into 
<project.root>.meta.slim3.model subpackage. The behavior will break the package 
hierarchy because <project.root>.meta package is for slim3 only and the 
'.slim3.model' postfix becomes redundant and unnatural now.

My opinion is that the original slim3gen rule which replace the LAST occurrence 
of '.model.' with '.meta.' is better at least in our case.

Thank you for quick fix and responses to this issue.

Original comment by mylee...@gmail.com on 18 Jun 2010 at 11:42

@GoogleCodeExporter
Copy link
Author

Your request is reasonable.
I fixed it.

Original comment by higaya...@gmail.com on 19 Jun 2010 at 2:01

@GoogleCodeExporter
Copy link
Author

Thank you very much! I will compile the slim3.jar from the current slim3 trunk 
source code and use it till the official 1.0.5 is released. 

Original comment by mylee...@gmail.com on 19 Jun 2010 at 3:04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant