草庐IT

mysql.data

全部标签

java - Spring Data CrudRepository 和事务

我正在尝试在CrudRepository接口(interface)上实现交易。我是这方面的初学者,我目前的问题是,当收到来自不同客户的大量请求时,我有时会收到重复的请求。为避免这种情况,我想在Spring中使用SQL事务及其实现,但我无法使其正常工作。这是我尝试过的方法:@Repository@EnableTransactionManagement@TransactionalpublicinterfaceApplicationPackageDaoextendsCrudRepository{/***Findifarecordexistsforthispackagename,*@param

java - 如何在 Spring data rest 中返回深层嵌套投影?

鉴于这3个实体:@EntityclassDepartment{Setemployees;SetgetEmployees(){returnthis.employees;};}@EntityclassEmployee{Nationalitynationality;NationalitygetNationality(){this.nationality;}}@EntityclassNationality{}我想为Department创建一个投影,返回所有部门及其员工和国籍。我所取得的成就是返回所有部门及其员工使用:@Projection(name="fullDepartment",types

java - JAVA和MYSQL如何删除一条记录(字符串)

我可以成功删除一个整数,但是当我尝试将其设为STRING时,它说“where子句中的未知列itemtodelete但我的ITEMTODELETE是在数据库中声明的字符串而不是整数它不删除字符串多少?下面是我的代码:privatevoidDeleteButtonActionPerformed(java.awt.event.ActionEventevt){intdel=(prompt):if(del==JOptionPane.YES_OPTION){DelCurRec();}}publicvoidDelCurRec(){Stringid=field.getText();StringSQL=

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 - ClassNotFoundException : com. mysql.jdbc.Driver。用于 Web 应用程序的 JDBC MySQL 驱动程序

这个问题在这里已经有了答案:HowtoinstallJDBCdriverinEclipsewebprojectwithoutfacingjava.lang.ClassNotFoundexception(13个答案)关闭7年前。所以我有一个MySQLJDBC驱动程序的.jar文件,它在我的库源文件夹下,我有以下代码:publicstaticConnectiongetConnection()throwsSQLException{Connectionconn=null;try{Class.forName("com.mysql.jdbc.Driver").newInstance();Strin

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 - 从 2.6 升级到 3.7 时出现 BIRT JDBCException "Cannot load JDBC Driver class: com.mysql.jdbc.Driver"

我正尝试在我的Tomcat服务器上升级我的birt-viewer的版本,但我似乎在加载JDBC驱动程序时遇到错误:exception.error(1time(s))detail:org.eclipse.birt.report.engine.api.EngineException:Anexceptionoccurredduringprocessing.Pleaseseethefollowingmessagefordetails:Cannotopentheconnectionforthedriver:org.eclipse.birt.report.data.oda.jdbc.org.ecl

java - "550 SSL/TLS required on the data channel"使用 Apache Commons FTPSClient

我在需要加密数据通道的FTP服务器(ProFTPD1.3.3a)上使用FTPClient读取数据时遇到问题。在其他服务器上没有加密的情况下一切正常。我的代码是:FTPSClientftpsClient=newFTPSClient("TLS",false);log.debug("usingTLS");FTPClientConfigftpClientConfig=newFTPClientConfig(FTPClientConfig.SYST_UNIX);ftpClientConfig.setServerLanguageCode("de");ftpsClient.configure(ftpC