- 博客(43)
- 资源 (2)
- 收藏
- 关注
原创 如何在<set>查询中加入where条件
查询出所有messageBox,并且messageBox.replies的replies要求 PARENT_REPLY_ID is null生成的sql语句Hibernate: select replies0_.MESSAGEBOX_ID as MESSAGEBOX5_1_1_, replies0_.id as id1_, replies0_.id as id2_0_, replies0_
2013-03-31 18:56:45 1275
原创 Returning multiple entities and Alias injection names
Query query = getSession().createSQLQuery("select * from reply r join messagebox m on r.messagebox_id = m.id where m.id=? and r.parent_reply_id is null").addEntity(MessageBox.class).addEntity(Reply.cl
2013-03-31 18:47:53 603
原创 关于fetch
打算hql用fetch要注意Hibernate ignores my outer-join="true" or fetch="join" setting and fetches an association lazily, using n+1 selects!HQL queries always ignore the setting for outer-join or fetc
2013-03-31 10:37:25 671
原创 想删除check 但是查询没显示check的constraint_name如何删除
如果用select dbms_metadata.get_ddl('TABLE',表名,用户名) from dual;没有查询到要删除check的constraint_name名是可以用select * from user_constraints c where c.table_name=表名';来查看该表里所有的constraint然后再SEARCH_CONDITION列里面看
2013-03-30 11:08:54 1302
原创 sql的join语句转成hql出现的问题
我用sql语句写出了一条join语句select distinct m.name from messagebox m inner join reply r on m.getperson_id = r.send_reply_person_id where r.send_reply_person_id=1 unionselect m.name from messagebox m where m
2013-03-28 18:11:33 624
原创 博客有的文章发不出去解决了
之前好几次出现博客编辑好了,却发送失败。。起先我以为是有的关键字被屏蔽了,或者是因为发的英文比较多,有些格式或者字体等无法保存的原因吧。。。但是我改用无线网之后却发送成功了。。。估计是网络的问题。。。
2013-03-28 17:49:40 1164
原创 outer joins
Outer Joins An outer join extends the result of a simple join. An outer join returns all rows that satisfy the join condition and also returns some or all of those rows from one table for which no r
2013-03-28 17:40:00 715
转载 Struts 2 nesting iterators
QUESTIONcan't believe how something this simple can seem so hard to do in Struts 2.This is approximately what I would like to do as it would be done in Java. for (Parent parent : parents){ fo
2013-03-27 20:24:48 484
原创 关于key
举个例子hbm1 用hbm1时,当你想l取出childrenRepliesHibernate: select replies0_.MESSAGEBOX_ID as MESSAGEBOX5_1_1_, replies0_.id as id1_, replies0_.id as id2_0_, replies0_.title as t
2013-03-27 17:12:07 584
转载 inverse = “true” example and explanation
Always put inverse=”true” in your collection variable ?There are many Hibernate articles try to explain the “inverse” with many Hibernate “official” jargon, which is very hard to understand (at leas
2013-03-27 16:17:22 569
转载 How to display hibernate sql parameter values – Log4j
ProblemHibernate has basic logging feature to display the SQL generated statement withshow_sql configuration property.Hibernate: INSERT INTO mkyong.stock_transaction (CHANGE, CLOSE, DATE, OPEN
2013-03-27 15:06:38 1063
转载 为了有利于保护安全性,internet explorer已经限制此网页运行可以访问计算机的脚本或activex控件
打开工具——Internet选项-->高级 找到"允许活动内容在我的计算机上的文件中运行" 打上勾 确定 下次就不出了 转自:http://zhidao.baidu.com/question/23680474.html
2013-03-27 13:23:17 1371
原创 automatic dirty checking
private void addPersonToEvent(Long personId, Long eventId) { Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); Person aP
2013-03-26 16:22:00 598
原创 java.lang.ClassCastException: java.lang.String cannot be cast to java.sql.Clob
clob, blob Type mappings for the JDBC classes java.sql.Clob andjava.sql.Blob. These types can be inconvenient for some applications, since the blob or clob object cannot be reused outside of a tr
2013-03-26 16:10:56 10444
转载 varchar2(10 byte)和varchar2(10 char)有什么不同
The VARCHAR2 datatype specifies a variable-length character string. When you create a VARCHAR2 column, you supply the maximum number of bytes or characters of data that it can hold. Oracle subsequentl
2013-03-26 10:59:39 1601
原创 xheditor实现上传
package com.yuxuan.action;import java.io.File;import java.io.IOException;import org.apache.commons.io.FileUtils;import org.springframework.context.annotation.Scope;import org.springfra
2013-03-25 14:14:57 985
转载 hibernate.hbm2ddl.auto
Hibernate's hbm2ddl toolThis entry also appears in my new blog at http://blog.eyallupu.com. A direct link to the entry ishere.Hi again,I was asked by one of my customers about the
2013-03-21 15:24:23 967
转载 Oracle JDBC dataType 对应关系
SQL DatatypesJDBC TypecodesStandard Java TypesOracle Extension Java Types STANDARD JDBC 1.0 TYPES: CHARjava.sql.Types.CHARjava.lang
2013-03-21 11:40:08 2271
原创 oracle number sequence 和 java.util.Long范围关系oracle sequence的取值范围是
oracle sequence的取值范围是 NOMAXVALUE SpecifyNOMAXVALUE to indicate a maximum value of 1028-1 for an ascending sequence or -1 for a descendin
2013-03-21 11:26:10 1469
转载 Mysql,Oracle,Java数据类型对应
MysqlOracleJava BIGINT NUMBER(19,0)java.lang.Long BIT RAWbyte[] BLOB BLOB RAWbyte[] CHAR CHARjava.la
2013-03-21 11:23:10 641
原创 由于有外键引用表使得表无法删除ORA-02449
可以用drop table 表名 cascade constraints;用cascade constraints一定要小心,oracle会把其他参照该表的外键删除掉,也会删除掉drop表的任何constraint,包括触发器,虽然可以用flashback恢复,flashback的前提是用drop之前先用alter database flashback on具体如何flashback请
2013-03-20 17:36:03 5052
转载 ORA-01849: hour must be between 1 and 12
问题:这个错误通常出现在你使用to_date函数时,区域时间设定为24小时。 解决方法:如果对Oracle语言设置设定为使用12小时的时间,这个问题就会在转换24小时的时间格式时发生。为了解决这一问题,在HH后增加24,格式如下:to_date('1997-01-01:00:00:00','YYYY-MM-DD:HH24:MI:SS')转自:http://blog.csdn
2013-03-20 16:50:40 10404
转载 ORA-01219:database not open:queries allowed on fixed tables/views only
“ORA-01219:数据库未打开:仅允许在固定表/视图中查询”的警告窗口! 解决办法:登录Oracle SQL*Plususername syspassword saString orcl as sysdba这一段是找出打开数据库的时候报错的地方SQL> select open_mode from v$database;OPEN_MODE --
2013-03-20 16:50:01 3125
原创 oracle 不能rollback ddl语句 比如drop
End of a TransactionA transaction ends when any of the following actions occurs:A user issues a COMMIT or ROLLBACK statement without a SAVEPOINT clause.In a commit, a user explicitly or im
2013-03-20 12:57:22 2490
原创 jquery如何引用jsp变量实现获得的cookiepassword写入密码里
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%String name="";String password="";Cookie[] cookies = request.getCookies(); if(cooki
2013-03-19 22:34:32 1223
转载 Win7 x64 PL/SQL 连接 Oralce 提示 Could not initialize "%ORACLE_HOME%\bin\oci.dll"
今天在 x64 的 Win7 上重新安装了 Oralce 后,通过 PL/SQL 连接数据库时,提示如下错误信息环境windows7 64bitOracle win64 11gR2PL/SQL v9.0详细错误信息initialization errorcould not initialize "c:\oracle\product\11.2.0\dbhome_1\b
2013-03-19 10:37:28 622
原创 oracle约束的ENABLE 和disable以及冲突信息exceptions
oracle的约束可以启用和禁用,禁用之后将不再受约束,如果你想在启用,oracle会检查加上约束是否和表中数据有冲突,如果有冲突则抛出异常,并把异常放入exceptions表中,该表需要自己创建,你可以通过select * from exceptions查看哪个rowid出现冲突。 上图是我启动约束 sys_c0011184出现错误上图查看抛出的错误信息查看该ro
2013-03-18 15:23:06 957
原创 oracle存储过程创建,hibernate调用存储过程
想通过hibernate save时,如果某属性是null,oracle自动把这个null返回成'N',也就是用到了存储过程procedure。通过oracle文档我写了一个简单的procedureCREATE OR REPLACE PROCEDURE "SCOTT"."AUTHOR_ENABLE_DEFAULT" (enable_in in char,enable_return ou
2013-03-16 16:35:55 1043
原创 javamail发送网页邮件,且有中文
public void sendMail() throws IOException { // create some properties and get the default Session Properties props = new Properties(); props.put("mail.smtp.host", "smtp.sina.com.cn"); props.se
2013-03-15 15:14:30 948
转载 How to configure environment to use JavaMail?
11down vote accepted If you're looking for a tutorial to configure an SMTP server, you shouldn't be looking for JavaMail. Simply look for a tutorial on your server of choice (Kerio, for
2013-03-14 21:59:05 556
转载 hibernate 数据库类型 date没有时分秒解决
问题:在数据库表中日期字段中存的日期光有年月日,没有时分秒。解决: 检查表的相应映射xml文件。 如果同上面所写,那问题出在 type类型上了。 正确写法 : Hibernate映射类型、对应的Java时间和日期类型及对应的标准SQL类型 映 射 类型Java类型
2013-03-14 14:30:02 3458
原创 s:fielderror 总是出现ul 改了theme=simple也没用
网上找了一下用法,不过看的不痛快,自己查了下文档这个是template和theme定义,要理解的就是theme是一系列templates包含在一起提供的普遍功能,它是针对很多template而言的,而template是有特定的tag参照的这是simple theme定义,而为什么fielderror不起作用,之后说上面说可以通过重写template,复制到applicati
2013-03-14 12:44:01 1129
转载 struts2标签--form中的theme属性
struts2中theme属性包括xhtml,html,simple,ajax 。默认是xhtmltheme:设置struts2标签的主题,默认为xhtml。theme=xhtml时:会默认额外生成tr,td。theme=simple时:就生成标签所对应的html标签形式。在默认情况下,表单元素是分布在不同行的。如下代码:我们看着以上的代码跟HTML的差不了
2013-03-13 16:31:51 631
转载 如何让html页面不缓存
有时候因为特殊的需要,希望html不要缓存,在html的头部加入如下代码就可以了转自:http://angel-gaofang.blog.163.com/blog/static/10907875020091193346933/
2013-03-13 16:31:01 1361
原创 如何修改Date格式
date存入了月日年,时分秒没有存查于是查找NLS_DATE_FORMAT发现可以用但是只是本连接有效。。如果断开连接在连上数据库职能重新设置有查出于是照着设置了然后重启sql/plus,想查下NLS_DATE_FORMATselect * from v$nls_parameters where parameter = 'NLS_DATE_FOR
2013-03-13 13:43:19 2177
转载 Struts 2 <s:checkbox> checkbox example
Download It – Struts2-CheckBox-Example.zipIn Struts 2 , you can use the tag to create a HTML check box. ThefieldValue=”true” is the actual value that will be submitted by the check box.name
2013-03-12 22:03:20 1399
原创 ajax传入中文参数 action 接受如何避免乱码
$('input[id="nameForm1"]').change(function(){ clickName = true; var name=encodeURI(($(this).val())); //alert("utf-8"+name); if($(this).val().length!=0){ $.get("author/authorAction_check
2013-03-12 19:19:36 1762
原创 Could not load org.springframework.aop.framework.AdvisedSupport$MethodCacheKey
错误提示:Could not load org.springframework.aop.framework.AdvisedSupport$MethodCacheKey. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to ter
2013-03-12 15:19:32 2365
转载 Struts2 整合jQuery实现Ajax功能
Struts2 整合jQuery实现Ajax功能技术领域很多东西流行,自然有流行的道理,这几天用了jQuery,深感有些人真是聪明绝顶,能将那么多技术融合的如此完美。首先明确个概念:jQuery是什么:是使用javascript语言开发的,用于满足项目前台各种操作需要的js程序文件。也就是说,jQuery基本上就是个js程序集,基础核心是jQuery.js文件。l 当然根据不同的
2013-03-12 10:55:43 878
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人