select * from TABLE where id=1 FOR UPDATE 当一个用户发出select..for update的错作准备对返回的结果集进行修改时,如果结果集已经被另一个会话锁定,就是发生阻塞。需要等另一个会话结束之后才可继续执行。 可以通过发出 select… for update nowait的语句来避免发生阻塞,如果资源已经被另一个会话锁定,则会返回...
Compass是一个强大的,事务的,高性能的对象/搜索引擎映射(OSEM:object/search engine mapping)与一个Java持久层框架. Compass实现了通过注册Hibernate的相关事件实现了数据的实时索引.. 我写Spring+Compass+Hibernate做了一个例子..通过这个例子顺便看了下源码. <bean id="compassGps" class="org.compass.gps.impl.Si...
ks.load(fis, password); //keystore中的每一项都用“别名”字符串标识。 //使用指定保护参数获取指定别名的keystoreEntry。 //KeyStore.PrivateKeyEntry保存PrivateKey和相应证书链的KeyStore项。 方法1. KeyStore.PrivateKeyEntry pkEntry = (KeyStore.PrivateKeyEntry) ks.getEntry( "keystore别名", new Key...
http://www.iteye.com/topic/106466 JDK1.5之前,我们可以用重载来实现,但是这样就需要写很多的重载函数,显得不是很有效。 如果使用可变参数的话我们只需要一个函数就行了。
// 获得的formatter DateFormat formatter = DateFormat.getDateTimeInstance(); TimeZone timezone = TimeZone.getTimeZone("Asia/Tokyo"); //设置DateFormat的时区 formatter.setTimeZone(timezone); // 获得格式化后的时间 String dateTime = formatter.format(new Date()); ...
RSA是一种对称加密算法,但加密时出现这个错误的原因,是因为使用了私钥进行加密. 正常应该使用公钥进行加密,然后通过私钥进行解密. 代码: KeyPair keypair = KeyPairGenerator.getInstance("RSA").generateKeyPair(); String str = "hello world"; Cipher cipher = Cipher.getInstance("RSA"); ...
System.out.println(cache.get("aa"));//如果这个时候,期待cache是否过期。但是实际的情况是。ehcache依然能获取到相关数据. 当你去调用ehcache.put动作时,会调用applyDefaultsToElementWithoutLifespanSet(element); 方法内容: if (!element.isLifespanSet()) { ...
因为spring动态代理封装MethodInvocation。导致获取不到方法annotation原因. spring如果需要前后通知的话。。一般会实现MethodInterceptor public Object invoke(MethodInvocation invocation) throws Throwable invocation.getMethod().getAnnotations(); // 根本得不到原来类方法上的annotation ...
启动(Bootstrap)类加载器:引导类装入器是用本地代码实现的类装入器,它负责将<Java_Runtime_Home>/lib下面的类库加载到内存中,但是虚拟机出于安全等因素考虑,不会加载< Java_Runtime_Home >/lib存在的陌生类,开发者通过将要加载的非JDK自身的类放置到此目录下期待启动类加载器加载是不可能的。
delete from sns_hits where id not in (select id from another_table) 也是麽有问题的 但是 delete from sns_hits where id not in (select id from sns_hits) 就TMD有问题了 解决棒法是创建临时表 CREATE TEMPORARY TABLE tmp_sns_hits (