草庐IT

data-tools-id

全部标签

java - JPA/Hibernate 嵌入式 ID

我想做这样的事情:一个ReportingFile对象,可以是LogRequest或LogReport文件。(两者结构相同)Reporting对象包含一个logRequest,一个带有日期的logReport列表。我尝试设置一个EmbededId,这将是logRequest的一个属性。这就是我遇到的问题。我不是来管理嵌入式ID的。(http://docs.jboss.org/hibernate/stable/annotations/reference/en/html_single/#entity-mapping-identifier)如果你知道我应该怎么做:)一个例子(不工作)是:@En

java - Hibernate 的 load() 方法对不存在的 ID 做了什么?

我对Session.load上的JavaDocs有点困惑:Returnthepersistentinstanceofthegivenentityclasswiththegivenidentifier,assumingthattheinstanceexists.Thismethodmightreturnaproxiedinstancethatisinitializedon-demand,whenanon-identifiermethodisaccessed.Youshouldnotusethismethodtodetermineifaninstanceexists(useget()ins

java - 嵌入式 id 和 "repeated column in mapping for entity..."异常

我遇到了JPA和Hibernate的问题,但未能解决。所以,这是我的applicationContext.xml:truecreate这是我的性能实体:packagecom.abt.fiifootballmanager.entity;importjava.io.Serializable;importjavax.persistence.*;importjava.math.BigDecimal;importjava.util.List;@Entity@Table(name="PERFORMANCES")@NamedQuery(name="Performance.findAll",query

java - 获取 javax.net.ssl.SSLException : Received fatal alert: protocol_version while scraping data using Jsoup

我正在尝试使用Jsoup从站点获取数据。该网站的链接是Clickhere!这是我获取数据的代码。`//WARNING:doitonlyifsecurityisn'timportant,otherwiseyouhave//tofollowthisadvices:http://stackoverflow.com/a/7745706/1363265//CreateatrustmanagerthatdoesnotvalidatecertificatechainsTrustManager[]trustAllCerts=newTrustManager[]{newX509TrustManager()

java - 删除然后创建记录导致Spring Data JPA重复 key 冲突

因此,在这种情况下,我需要记录头记录,删除它的详细信息,然后以其他方式重新创建详细信息。更新细节将带来太多麻烦。我基本上有:@Transactionalpublicvoidcreate(Integerid,ListcustomerIDs){Headerheader=headerService.findOne(id);//headerisfound,hasmultipledetails//Removethedetailsfor(Detaildetail:header.getDetails()){header.getDetails().remove(detail);}//Iterateth

java - Spring Data REST - 如何在投影中包含计算数据?

我定义了以下域类。贷款类别@Data@EntitypublicclassLoan{@Id@GeneratedValue(strategy=GenerationType.IDENTITY)privatelongid;privateStringloanTitle;@OneToMany(cascade=CascadeType.ALL,orphanRemoval=true)@JoinColumn(name="loan_id")privateListallowances;}津贴等级@Data@EntitypublicclassAllowance{@Id@GeneratedValue(strate

java - Ant :[xslt] java.lang.ClassNotFoundException:org.apache.tools.ant.taskdefs.optional.TraXLiaison

我有一个Ant构建,它在Windows上运行良好,但当我将它移植到Linux上时似乎出现了问题。问题在这里:[xslt]java.lang.ClassNotFoundException:org.apache.tools.ant.taskdefs.optional.TraXLiaison我已经尝试过以下方法:将xalan.jar、xercesImpl.jar和xml-apis.jar放入$ANT_HOME/lib>目录。将它们从构建文件中放入类路径安装ant的可选类。我正在使用EC2Linux实例(基本64位AmazonLinuxAMI2011.02.1Beta(AMIId:ami-8e

java - 注册了多个 UserDetailsS​​ervice。请在 <remember-me/> <openid-login/> 或 <x509/> 元素中使用特定的 Id 引用

我正在尝试使用springsecurity启用记住我的功能但是,我似乎在remember-me元素的某处指定了userService?我该怎么做。我在启动tomcat时遇到的错误是MorethanoneUserDetailsServiceregistered.PleaseuseaspecificIdreferenceinorelements. 最佳答案 好吧,这并不难,以防万一其他人发现spring文档相当难以导航: 关于java-注册了多个UserDetailsS​​ervice。请在

java.sql.SQLException : Data truncated for column 'MonthlyIncome' at row 1 error 异常

我正在尝试使用我的GUI更新数据并将数据保存到我的数据库中。我的问题是,如果我不向我在数据库中允许为null的某些文本框输入任何数据,我会收到这种错误:java.sql.SQLException:Datatruncatedforcolumn'MonthlyIncome'atrow1 最佳答案 当您输入的数据对于列来说太长时,通常会出现此问题。在这种情况下,您更新“MonthlyIncome”字段所用的任何数据都太长了。 关于java.sql.SQLException:Datatrunca

java - 提供了错误类型的 id hibernate

我遇到错误:org.hibernate.TypeMismatchException:为类BEntity提供了错误类型的ID。预期:类BEntity,得到类AEntitypublicclassBEntityimplementsSerializable{@Id@Column(name="NUM")privateStringnum;@Id@Column(name="INIT")privateStringinit;@Column(name="V_CNT")privateIntegervcnt;//{{{somecolumnomitted}}}//}publicclassAEntityimple