在某些情况下,我想只更新一个collumn,但我不想从数据库中获取对象,我只有它的ID和我想要更新的值.
由于其他值为null,因此hibernate将更新为null.我想知道一些标准来擦除更新中的其他列.
我读到了dynamic-update = true,它只排除了未修改的属性.但是在我的更新中仍然存在空值.
有谁有想法吗?谢谢!费利佩
我在jSCSI implamantation中有一个java.nio.channels.SocketChannel,当我尝试打开大小超过4GB的驱动程序时,它会断开连接.iscsi RFC表示BasicHeaderSegment.BHS_FIXED_SIZE可能是48,所以在这个位置我可以读取通道上的字节.java doc说5种类型的错误,但是我的应用程序抛弃了最后一个没有说明特定信息的错误.1 - NotYetConnectedException 2 - ClosedChannelException 3 - AsynchronousCloseException 4 - ClosedByInterruptException 5 - IOException
public final int read(final SocketChannel sChannel) throws InternetSCSIException, IOException, DigestException {
// read Basic Header Segment first to determine the total length of this
// Protocol Data Unit.
clear();
final ByteBuffer bhs = ByteBuffer.allocate(BasicHeaderSegment.BHS_FIXED_SIZE);
int len = 0;
while (len < BasicHeaderSegment.BHS_FIXED_SIZE) {
int lens = sChannel.read(bhs);
if (lens == -1) {
// The Channel was closed at the Target (e.g. the …Run Code Online (Sandbox Code Playgroud) 我必须使用 bash 脚本加密字符串,就像使用 javax.crypto.Cipher 加密一样。在 java 中,我使用带有密钥“0123456789”的 AES-256。但是当我使用openssl时,我不得不将“0123456789”转换为十六进制,但结果与java不同
echo "lun01" | openssl aes-256-cbc -e -a -K 7573746f726530313233343536373839 -iv 7573746f726530313233343536373839
Run Code Online (Sandbox Code Playgroud)
dpMyN7L5HI8VZEs1biQJ7g==
爪哇:
public class CryptUtil {
public static final String DEFAULT_KEY = "0123456789";
private static CryptUtil instance;
private String chiperKey;
private CryptUtil(String chiperKey) {
this.chiperKey = chiperKey;
}
public static CryptUtil getInstance() {
if (null == instance) {
instance = new CryptUtil(DEFAULT_KEY);
}
return instance;
}
public static CryptUtil getInstance(String cipherkey) {
instance = new CryptUtil(cipherkey);
return instance;
}
public String …Run Code Online (Sandbox Code Playgroud) 是否可以将MemoryMappedFile与策略一起使用以将文件分解为固定大小,例如250MB?我的log4j2.xml是这样的,但我想将日志文件分解为250MB,我需要使用MemoryMappedFile来实现IO性能.
<Configuration monitorInterval="30">
<Appenders>
<MemoryMappedFile name="MemoryMap" fileName="output/jscsi-out.log">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{2} - %m%n(%L)" />
<Policies>
<TimeBasedTriggeringPolicy />
<SizeBasedTriggeringPolicy size="250 MB" />
</Policies>
</MemoryMappedFile>
</Appenders>
<Loggers>
<Logger name="br.com" level="debug" additivity="false">
<AppenderRef ref="MemoryMap" />
</Logger>
<Logger name="org.jscsi.target.TargetServer" level="debug"
additivity="false">
<AppenderRef ref="MemoryMap" />
</Logger>
<Logger name="org.jscsi.target.storage" level="info"
additivity="false">
<AppenderRef ref="MemoryMap" />
</Logger>
<Logger name="org.jscsi.service" level="debug" additivity="false">
<AppenderRef ref="MemoryMap" />
</Logger>
<Root level="error" includeLocation="true">
<AppenderRef ref="MemoryMap" />
</Root>
</Loggers>
</Configuration>
Run Code Online (Sandbox Code Playgroud)