绑定到SnakeYAML / Play框架中的内部类

时间:2011-01-04 21:26:25

标签: playframework snakeyaml

我有一个这样的模型:

package models;

@Entity 
public class Order extends Model 
{ 
    @Entity 
    public static class Line extends Model 
    { 
    } 
} 

如何为Order.Line加载灯具?正常的方式不起作用:

Order.Line(OrderLine_1): 
    ....... 

原因:

RuntimeException occured : Class models.Order.Line was not found 
play.exceptions.JavaExecutionException: Class models.Order.Line was 
not found 
        at play.jobs.Job.call(Job.java:127) 
        at Invocation.Job(Play!) 
Caused by: java.lang.RuntimeException: Class models.Order.Line was not 
found 
        at play.test.Fixtures.load(Fixtures.java:224) 
        at com.site.jobs.Bootstrap.doJob(Bootstrap.java:47) 
        at play.jobs.Job.doJobWithResult(Job.java:45) 
        at play.jobs.Job.call(Job.java:118) 
        ... 1 more 
Caused by: java.lang.ClassNotFoundException: models.Order.Line 
        at java.lang.ClassLoader.findClass(ClassLoader.java:359) 
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307) 
        at 
play.classloading.ApplicationClassloader.loadClass(ApplicationClassloader.j ava: 
84) 
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252) 
        at play.test.Fixtures.load(Fixtures.java:200) 
        ... 4 more 

1 个答案:

答案 0 :(得分:3)

在YML文件中,使用Order$Line代替Order.Line

Order$Line(OrderLine_1):
    ....