当我在Toad中的SQL下执行时,其抛出“ ORA-01735:无效的ALTER TABLE选项 ”。
ALTER TABLE CALCULATE
ADD (CAL_METHOD VARCHAR2(50), REMARKS VARCHAR2(500));
Run Code Online (Sandbox Code Playgroud)
但是在SQL Developer中执行成功后,SQL / Toad是否存在任何问题。请给我建议。
我试图在spring控制器中使用synchronize方法.因为我们的支付网关一次点击方法[@RequestMapping(value ="/ pay",method = RequestMethod.POST)]不同的交易[txn id:txn01&txn02].但由于使用了同步块,这两个不同的事务处理逐个并行处理.
问题 - >为什么我在控制器中使用同步块就是说,事务[txn01]命中[@RequestMapping(value ="/ pay",method = RequestMethod.POST)]两次,就像来自支付网关的重复呼叫一样.在完成第一次呼叫[后端处理]之前,我从支付网关获得相同转账的第二次呼叫.
有没有办法处理两个不同的事务并行使用同步块中的事务ID而不是重复调用我的意思是相同的转义.请指教.
如果我的问题不清楚,请告诉我.
@RequestMapping(value="/pay",method=RequestMethod.POST)
public String payAck(HttpServletRequest httpRequest,HttpServletResponse httpResponse,HttpSession session){
synchronized (this) {
return this.processPayAck(httpRequest, httpResponse, session);
}
}
public synchronized String processPayAck(HttpServletRequest httpRequest,HttpServletResponse httpResponse,HttpSession session){
// Payment Acknowledgment process here
if (sametranIDNotExists) {
// first call here
callWS(); - processing business logic.
return someURL;
} else {
// Gets second call here before first call completed
return someURL;
}
}
Run Code Online (Sandbox Code Playgroud)
修改后的代码
在同步块中使用实习生是否正确?
@RequestMapping(value="/pay",method=RequestMethod.POST)
public String payAck(HttpServletRequest httpRequest,HttpServletResponse …Run Code Online (Sandbox Code Playgroud) 我正在为我的项目使用继承的bean类.这里有些超类是空的,子类可以有字段,有些子类是空的,超类可以有字段.
我的要求是从Sub类获取所有私有/公共字段以及从Super类获取所有公共/受保护字段.
下面我试图实现它.但我没能达到我的要求.请提供一些建议来实现这一目标.
Field fields [] = obj.getClass().getSuperclass().getDeclaredFields();
Run Code Online (Sandbox Code Playgroud)
如果我使用上面的代码,我只能获得超类字段
Field fields [] = obj.getClass().getFields();
Run Code Online (Sandbox Code Playgroud)
如果我使用上面的代码,我可以从Sub类和超类字段获取所有字段
Field fields [] = obj.getClass().getDeclaredFields();
Run Code Online (Sandbox Code Playgroud)
如果我使用上面的代码,我可以获得Sub类的公共和私有所有字段.
我要尝试创建目录并将数据写入该文件。我正在尝试使用 java nio 更有效地编写文件。我的疑问是如何在下面写下它之后关闭它是我的代码。请给我建议。
这是创建目录和写入大型数据文件的正确方法 [200 kb]。
java.nio.file.Path path = java.nio.file.Paths.get(filePath);
try {
if (!java.nio.file.Files.exists(path)) {
java.nio.file.Files.createDirectories(path.getParent());
path = java.nio.file.Files.createFile(path);
path = java.nio.file.Files.write(path, data.getBytes());
} else {
java.nio.file.Files.write(path, data.getBytes("utf-8"),
java.nio.file.StandardOpenOption.CREATE, java.nio.file.StandardOpenOption.TRUNCATE_EXISTING);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试将 xsd 导入另一个 xsd。我看到一些需要导入的问题。我无法理解网络中提供的解决方案。下面是我的 XSD。
我有 HEADER.xsd。这对于所有其他 xsd 都是常见的。
头文件.XSD
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Header" type="reqHeader"/>
<xs:complexType name="reqHeader">
<xs:sequence>
<xs:element name="MsgId" type="xs:string" minOccurs="0"/>
<xs:element name="MsgDesc" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
Run Code Online (Sandbox Code Playgroud)
消息1.XSD
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import namespace="" schemaLocation="\resources\xsd\HEADER.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" />
<xs:element name="Message">
<xs:complexType>
<xs:sequence>
<xs:element name="Header" type="xs:reqHeader" />
<xs:element name="Body">
<xs:complexType>
<xs:sequence>
<xs:element name="User">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="Name" minOccurs="1"/>
<xs:element type="xs:int" name="DOB" minOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Run Code Online (Sandbox Code Playgroud)
在这里,我试图导入被调用的元素,因为它对所有 xsd …
我正在尝试 使用&Hibernate验证来验证字符串日期javax.validation.我需要检查给定的字符串日期应该是过去的,它应该是正确的yyyyMMdd格式与所有约束,如闰年30th,31st日.
public class UserInformation {
@NotNull
public String idNum = null;
@NotNull
//@Past
@Pattern(regexp="\\d{4}(1[012]|0[1-9])(3[01]|[12]\\d|0[0-9])")
public String dob= null;
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用此代码但无法正常工作.有什么解决方案吗?如果我们有自定义验证器,那么它是在字段级别.请给出建议或代码片段.
我的代码试图将 NULL 插入 PreparedStatement 中的 setDouble 方法
ps.setDouble(++i, balance.getAmount());
Run Code Online (Sandbox Code Playgroud)
getAmount() 是 Double 字段。
我能够处理像
if (balance.getAmount() == null ) {
ps.setNull(++i, java.sql.Types.NULL);
}else{
ps.setDouble(++i, balance.getAmount());
}
Run Code Online (Sandbox Code Playgroud)
但是我的代码看起来很难看,因为我的代码有很多 setInt setLong setDouble 方法。
有没有办法巧妙地处理或有任何其他方法。请建议我。