小编Jam*_*ton的帖子

枚举不是枚举映射的有效类型

当我尝试将我的 web 应用程序部署到 Glassfish 容器(静态 shell 和服务器)时,我对以下异常感到非常头疼。基本上,我有一个实体类,它具有以下属性:

    @Entity
    public class Anniversary implements Serializable, Comparable<Anniversary>
    {
     ...

        @Enumerated
        private AnniversaryType type;

     ....Rest of class
     }
Run Code Online (Sandbox Code Playgroud)

它指的是一个枚举类,声明如下:

 public enum AnniversaryType
Run Code Online (Sandbox Code Playgroud)

该程序使用标准 Maven 项目在 Netbeans 8.0 中构建时没有任何抱怨,但在部署时会引发以下异常:

Caused by: Exception [EclipseLink-7151] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd):         org.eclipse.persistence.exceptions.ValidationException
Exception Description: The type [class com.mycompany.anniversaries_final.AnniversaryType] for the   attribute [type] on the entity class [class com.mycompany.anniversaries_final.Anniversary] is not a     valid type for an enumerated mapping. The attribute must be defined as a Java enum.
at org.eclipse.persistence.exceptions.ValidationException.invalidTypeForEnumeratedAttribute(ValidationException.java:1125) …
Run Code Online (Sandbox Code Playgroud)

java jpa maven

4
推荐指数
1
解决办法
1720
查看次数

如何将计算属性从路径传递给组件

以下面的例子为例:

  <script type="text/x-handlebars">
    <h2>Welcome to Ember.js</h2>

    {{outlet}}
  </script>

  <script type="text/x-handlebars" data-template-name="index">
    <ul>
    {{#each model as |item|}}
      <li>{{item}}</li>
    {{/each}}
    {{magnus-component name=firstName}}
    </ul>
  </script>

  <script type="text/x-handlebars" data-template-name="components/magnus-component">
  <!-- Doesn't appear -->
    {{name}}
  </script>
Run Code Online (Sandbox Code Playgroud)

...和

App = Ember.Application.create();

App.Router.map(function() {
});
App.IndexRoute = Ember.Route.extend({
  model: function() {
    return ['red', 'yellow', 'blue'];
  },
  name: "Magnus",
  surname: "Womble",
  fullName: Ember.computed('name', 'surname', function(){
    return this.get('name') + ' '+this.get('surname');
  })
});
Run Code Online (Sandbox Code Playgroud)

哪个可以在以下jsbin中找到:

http://emberjs.jsbin.com/higako/edit?html,js,output

如何正确地将fullName属性传递给组件模板?

ember.js

2
推荐指数
1
解决办法
4483
查看次数

在Elm中,我如何监听节点上生成的鼠标滚轮事件

请参阅Ellie上的以下示例:

module Main exposing (main)

import Html exposing (..)
import Html.Attributes exposing (style)
import Html.Events exposing (Options, onClick, onWithOptions)
import Json.Decode as JD
import Json.Decode.Extra exposing ((|:))
import Result exposing (withDefault)
import String as S


main : Program Never Model Msg
main =
    Html.program
        { init = init
        , update = update
        , subscriptions = subscriptions
        , view = view
        }


init : ( Model, Cmd Msg )
init =
    ( Model "", Cmd.none )


type alias Model …
Run Code Online (Sandbox Code Playgroud)

elm

1
推荐指数
1
解决办法
77
查看次数

标签 统计

elm ×1

ember.js ×1

java ×1

jpa ×1

maven ×1