开发者

Bind to an inner class in SnakeYAML / Play framework

开发者 https://www.devze.com 2023-02-03 01:28 出处:网络
I have a model like this: package models; @Entity public class Order extends Model { @Entity public static class Line extends Model

I have a model like this:

package models;

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

How can I load fixtures for Order.Line? The normal way doesn't work:

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

causes:

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.j开发者_JS百科ava: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 


In YML file, use Order$Line instead of Order.Line:

Order$Line(OrderLine_1):
    ....
0

精彩评论

暂无评论...
验证码 换一张
取 消