草庐IT

unique_constraint

全部标签

java.lang.LinkageError : loader constraint violation 错误

大家好我遇到过这样的链接错误问题:java.lang.LinkageError:loaderconstraintviolation:whenresolvingmethod"javax.xml.transform.Transformer.transform(Ljavax/xml/transform/Source;Ljavax/xml/transform/Result;)V"theclassloader(instanceoforg/jboss/mx/loading/UnifiedClassLoader3)ofthecurrentclass,org/richfaces/renderkit/T

java - 带有 H2 数据库的 JUnit : Unique index or primary key violation when adding multilingual services for multiple data

Hibernate在创建数据库的过程中,在oe_iv_student_lang表中为外键id_student添加了唯一键约束,因为我们要实现Serializable接口(interface)导致Hibernate不允许我们在其对应的子表中添加具有相同父外键的多行。我附上了代码片段以便更好地理解..学生类(class):importjavax.persistence.Column;importjavax.persistence.Entity;importjavax.persistence.GeneratedValue;importjavax.persistence.GenerationT

java - JSR303 : Trying to customize a constraint violation to be associated with a sub-path in a class-level relationship constraint validator

我正在使用JSR303并创建了一个类级别的约束,用于比较表单中的密码及其确认,我将在此处命名为@SameAs约束。理想情况下,我希望将约束与预期目标(confirmPassword)相关联,但显然封闭的bean不可用于提取密码prop。-因此是类级约束。我感兴趣地阅读了其他展示如何利用类级约束来验证关系的帖子,但找不到任何解释如何自定义约束违规以与子路径相关联的内容,在本例中为关系中的两个字段。我的问题如下:如何将违反约束的消息与“confirmPassword”字段而不是顶级对象相关联?我尝试使用javax.Validator.validate(target,context)的上下文

Java & Spark : add unique incremental id to dataset

使用Spark和Java,我试图向现有的具有n列的数据集[行]添加一个整数标识列。我使用zipWithUniqueId()或zipWithIndex成功添加了一个id,甚至使用了monotonically_increasing_id()。但没有一个能令人满意。示例:我有一个包含195行的数据集。当我使用这三种方法中的一种时,我得到一些像1584156487或12036这样的ID。另外,这些ID不是连续的。我需要/想要的非常简单:一个Integerid列,其值从1到dataset.count()foreach行,其中id=1后跟id=2,等等。我如何在Java/Spark中做到这一点?

java - 数学与 J/链接 : Memory Constraints?

我正在使用Mathematica及其J/LinkJava接口(interface)进行计算密集型基准测试。如果达到大约320MB的内存占用量,基准测试就会停止,因为这似乎是极限,垃圾收集器需要越来越多的时间并最终会失败。Mathematica函数ReinstallJava采用参数命令行。我试着做ReinstallJava[CommandLine->"java-Xmx2000m..."]但是Mathematica似乎完全忽略了-Xmx选项。如何为我的java程序设置-Xmx内存选项?320MB的限制从何而来?任何帮助将不胜感激。 最佳答案

java - H2 数据库 : referring to a table in root schema from a foreign key constraint

给定根架构中的表:CREATETABLEuser(usernameVARCHAR(50),passwordVARCHAR(50));和Quiz模式中的表:CREATETABLEQuiz.Results(usernameVARCHAR(50),pointsINT,FOREIGNKEY(username)REFERENCESuser(username));我无法实际创建外键,因为数据库声称表user实际上并不存在。我也不能随后添加外键:ALTERTABLEQUIZ.RESULTSADDFOREIGNKEY(username)REFERENCESuser(username)当然,这两个表都存

java - Java 导入语句错误 "The import javax.validation.constraints.NotNull cannot be resolved"

在开发Springroo项目后,发现类中有如下错误:Theimportjavax.validation.constraints.NotNullcannotberesolvedNotNullcannotberesolvedtoatype我正在使用STS3.1.0.RELEASE如何解决这个问题? 最佳答案 我遇到了同样的问题。我发现最新版本的SpringBoot需要单独的验证依赖项。我尝试在pom.xml文件中添加以下依赖项并且它起作用了。org.springframework.bootspring-boot-starter-vali

java - Spring 数据 MongoDB : How ignore unique indexed field when Document is embedded in another one?

我有一个这样定义的Contract类:@DocumentpublicclassContract{@IdprivateStringid;@Indexed(unique=true)privateStringref;privateStringstatus="pending";//getter&setter&hashcode&equals&tostring...}我想随时间保存契约(Contract)状态,所以我创建了一个Version类,如下所示:@DocumentpublicclassVersion{@IdprivateStringid;privateContractcontract;pr

Java Bean 验证 : GroupSequence with Class-Level Constraint

我有一个具有多个(自定义)内部约束和一个类级约束的bean类。我想在类级约束之前验证内部约束。代码如下所示:@GroupSequence({Inner.class,NewSlotBean.class})@TotalBeanValid(groups=NewSlotBean.class)publicclassNewSlotBean{@DayMonthYearString(groups=Inner.class)privateStringslotDay;@TimeString(groups=Inner.class)privateStringslotBegin;@LengthString(gro

java - 带有 postgresql 的串行列上的 Spring Data JPA "null value in column xxx violates not-null constraint"

我的实体有一个mapOrder字段,我希望它像下面这样自动递增:@EntitypublicclassMap{@Id@GeneratedValue(strategy=GenerationType.IDENTITY)privateLongid;@Column(columnDefinition="serial")privateLongmapOrder;//.......}生成的sql看起来不错:CREATETABLEmap(idbigserialNOTNULL,map_orderserialNOTNULL,...)但是当我用SpringDataJPA的存储库保存它时,像这样:Mapm=new