我正在尝试使用JPA/Hibernate设置以下表:
User:
userid - PK
name
Validation:
userid - PK, FK(user)
code
Run Code Online (Sandbox Code Playgroud)
可能有许多用户,每个用户可能有最多一个验证码或没有.
这是我的课程:
public class User
{
@Id
@Column(name = "userid")
@GeneratedValue(strategy = GenerationType.IDENTITY)
protected Long userId;
@Column(name = "name", length = 50, unique = true, nullable = false)
protected String name;
...
}
public class Validation
{
@Id
@Column(name = "userid")
protected Long userId;
@OneToOne(cascade = CascadeType.ALL)
@PrimaryKeyJoinColumn(name = "userid", referencedColumnName = "userid")
protected User user;
@Column(name = "code", length = 10, unique = true, nullable = false) …Run Code Online (Sandbox Code Playgroud) 我的XML的子字符串如下所示:
<foo value1="a" value2="b">value3</foo>
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用JAXB解析它.我已经设法解析值value1和value2但我遇到了"root"值的问题,因为它没有任何与之关联的标记.
我的课:
@XmlType(propOrder = {"value3"}, name = "foo")
@XmlAccessorType(XmlAccessType.FIELD)
public class Foo
{
@XmlAttribute
private String value1;
@XmlAttribute
private String value2;
@XmlElement(name = "")
private String value3;
}
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
我正在尝试使用hibernate验证器进行gwt验证.我按照从步骤http://code.google.com/p/google-web-toolkit/wiki/BeanValidation根据在样品检验项目和配置我的项目http://code.google.com/p/谷歌的web的工具包/源/浏览/中继/样品/验证/
我的.gwt.xml文件包含:
<inherits name="org.hibernate.validator.HibernateValidator" />
Run Code Online (Sandbox Code Playgroud)
和我的自定义验证工厂:
<replace-with class="my.package.here.client.validation.ValidatorFactory">
<when-type-is class="javax.validation.ValidatorFactory" />
</replace-with>
Run Code Online (Sandbox Code Playgroud)
验证在开发模式下在客户端和服务器端都很完美,但在尝试gwt编译时,我得到:
gwtc-production:
[java] Compiling module my.package.MyModule
[java] Validating newly compiled units
[java] [ERROR] Errors in 'jar:file:/hibernate-validator-4.2.0.Final-sources.jar!/org/hibernate/validator/constraints/impl/FutureValidatorForReadableInstant.java'
[java] [ERROR] Line 32: No source code is available for type org.joda.time.ReadableInstant; did you forget to inherit a required module?
[java] [ERROR] Errors in 'jar:file:/hibernate-validator-4.2.0.Final-sources.jar!/org/hibernate/validator/constraints/impl/FutureValidatorForReadablePartial.java'
[java] [ERROR] Line 32: No source code is available for type org.joda.time.ReadablePartial; did you forget to inherit a required module?
[java] [ERROR] Errors in …Run Code Online (Sandbox Code Playgroud)