随笔 - 23  文章 - 3  trackbacks - 0
<2006年4月>
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456

常用链接

留言簿(1)

随笔档案

搜索

  •  

最新评论

阅读排行榜

评论排行榜

注意writer的参数有多个,特别是有一个boolean的参数决定刷新或在附加文本

            log  =    new  PrintWriter( new  FileOutputStream(fl, true ), true );
            SimpleDateFormat df 
=   new  SimpleDateFormat( " yyyy.MM.dd 'at' hh:mm:ss\n "
);
            Date now 
=   new
 Date();
            String dateformat 
=
 df.format(now)
            BufferedWriter bf  
=   new  BufferedWriter( new  FileWriter(fl,  true
));
            bf.append(dateformat);
            bf.close();
            log.println(
" start connection databse: "
);
            log.println(
" driver name: " .concat(driveName);


输出的结果示例:
2006.12.12 at 10:21:13
start connection databse:
driver name:oracle.jdbc.driver.OracleDriver

posted @ 2006-12-12 12:16 aimy 阅读(214) | 评论 (0)编辑 收藏
1、org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.xindeco.business.pojo.NonageRegister#82]
 at org.hibernate.ObjectNotFoundException.throwIfNull(ObjectNotFoundException.java:27)
 at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:65)
 at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(ApplicationFilterChain.java:252)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
 at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
 at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
 at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
 at org.apache.catalina.core.ApplicationDispatcher.forward

错误的原因:
在nonregsiter中已经手动删除了id=‘82’的记录,而在WF_task以及wf-proces中还有bizclass = '3' && bizId = '82'的记录,只要删除wf-task中相应的记录.
posted @ 2006-07-09 16:17 aimy 阅读(227) | 评论 (0)编辑 收藏

ProcessInstance.hbm.xml:

<? xml version = " 1.0 "  encoding = " UTF-8 " ?>

<! DOCTYPE hibernate - mapping PUBLIC
    
" -//Hibernate/Hibernate Mapping DTD 3.0//EN "  
    
" http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd " >

< hibernate - mapping
>
    
< class
        name
= " com.xindeco.workflow.ProcessInstance "
        table
= " WF_PROCESS "
        dynamic
- update = " true "
        dynamic
- insert = " true "
        select
- before - update = " false "
        optimistic
- lock = " version "
    
>

        
< id
            name
= " ID "
            column
= " ID "
            type
= " long "
            length
= " 30 "
        
>
            
< generator  class = " native " >
            
</ generator >
        
</ id >

        
< discriminator
            column
= " bizClass "
            type
= " string "
        
/>
        
        
< property
            name
= " state "
            type
= " java.lang.Integer "
            update
= " true "
            insert
= " true "
            access
= " property "
            column
= " state "
            length
= " 10 "
        
/>
        
        
< many - to - one
            name
= " flow "
            
class = " com.xindeco.workflow.WFFlow "
            cascade
= " none "
            outer
- join = " auto "
            update
= " true "
            insert
= " true "
            access
= " property "
            column
= " flowId "
        
/>

        
< set
            name
= " tasks "
            lazy
= " true "
            inverse
= " true "
            cascade
= " delete "
            sort
= " unsorted "
        
>

              
< key
                  column
= " processId "
              
>
              
</ key >

              
< one - to - many
                  
class = " com.xindeco.workflow.WFTask "
              
/>

        
</ set >

    
</ class >

</ hibernate - mapping >

CollRegPI.hbm.xml:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
      
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
          
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping default-access="field" >

  
<subclass name="com.xindeco.business.pojo.wf.CollRegPI"
            discriminator
-value="2"
            
extends="com.xindeco.workflow.ProcessInstance"
            lazy
="false">

            
<many-to-one name="collReg"
                 
class="com.xindeco.business.pojo.CollReg"
                 column
="bizId"
                 cascade
="none"/>
</subclass>
</hibernate-mapping>

数据库的数据:
     id    flowid    bizId   bizClass   state
  21       2           9          2              0
 22         2         10         2              0
 23         2         11         2              0
 24         2         12         2              0
 25         2         13         2              0
 26         2         14         2              0
 29         2         17         2              0
 30         2         18         2              1
 44         4         1          32             0
 45         4         2           32             1
 46         5          1          33             0
 47         5          2           33             1
 48         5          3           33             0
 50         3          1            3              0
 51         3         1            3              0

如果bizclass=2是同一种类型的class。由        
         <discriminator
            column
="bizClass"
            type
="string"
        
/>来表示。
posted @ 2006-07-06 10:37 aimy 阅读(384) | 评论 (0)编辑 收藏
org.hibernate.hql.QuerySplitter - no persistent classes found for query class:
意味着你没有将someclass的配置文件放在hibernate.config或没有写配置文件。
posted @ 2006-07-04 10:30 aimy 阅读(1169) | 评论 (0)编辑 收藏
1,通过构造函数创建bean
 <bean id="baseDAO" class="com.aimy.core.dao.impl.BaseDAOImpl">
相当于
basedaoimpl baseDAO 
= new BaseDAOImpl();
2,通过静态工厂创建bean
<bean id="driver1" class="com.aimy.driver.driverManager"
factory
-method="createInstance"/>
相当于
Object driver1 
= driverManager.createInstance();

其中没有指定driverManager.createInstance();返回对象的类型,而且createInstance()必须是static方法
3,通过实例工厂方法创建bean
<bean id="father" class="com.aimy.Father"/>
........
<bean id="son" factory-bean="father" factory-method="createSon"/>
相当于
Father father 
= new Father();
Object son 
= father.createSon();

其中father和son必须在同一个bean工厂或父bean工厂,即在同一个applicationcontext或子applicationcontext


二、如果applicationcontext默认预实例化那些singleton bean,这样就可以在beanfactory装载时就检查出错误,而如果singleton bean设置为lazy-mode,
posted @ 2006-06-26 23:26 aimy 阅读(232) | 评论 (0)编辑 收藏
hibernate 保存空值的细节
1。如果字段在pojo类中是复杂对象类型,则在数据库用nulll表示。
2。如果字段在pojo类中是简单数据类型,则在数据库用0表示。
posted @ 2006-06-26 09:56 aimy 阅读(170) | 评论 (0)编辑 收藏
1. document.name.value----->document.all.name.value
2. eval(document.all.name)---->eval('document.all.name')
3.javascript:window.history.go(-1)
4、在action方法中只要抛出exception,就会跳到jspexception页面中,怎么处理。
posted @ 2006-06-22 13:19 aimy 阅读(188) | 评论 (0)编辑 收藏
为了将业务逻辑放到service层,比如判断登陆用户的信息,而在service层无法用SysUser user = (SysUser) request.getSession().getAttribute(WebConstants.SESSION_USER);因此在BaseService设一个属性为
      public void setOperator(Entity operator);
      public Entity getOperator();
posted @ 2006-05-17 11:17 aimy 阅读(291) | 评论 (0)编辑 收藏
   private static WFEngine instance;
    public static final WFEngine getInstance() {
        return instance;
    }
posted @ 2006-05-17 10:05 aimy 阅读(195) | 评论 (0)编辑 收藏

<sqlMap namespace="PersonnelRegist">

  <typeAlias alias="ID" type="com.xindeco.core.pojo.IDEntity"/>
  </select>
   <select id="GraAppInfo.searchUpApply" parameterClass="com.xindeco.business.dto.GraAppInfoDTO"    resultClass="ID" cacheModel="userCache">
   select distinct a.ID AS id
   from TGraAppInfo a  left join TEMPLOYUNITBASEINFO b on a.unit=b.MEMBERID
   where appstatus = '1'
   <dynamic>
   <isNotEmpty prepend="AND" property="name">(a.name like '%' + #name# + '%')</isNotEmpty>
   <isNotEmpty prepend="AND" property="unit">(b.UNITNAME like '%' + #unit# + '%')</isNotEmpty>
   </dynamic>
  </select>
</sqlMap>

注意sqlmapGraAppInfoDTO的name,unit只能是基本数据类型,不能是复杂数据类型.
2、<script>的位置
<script>
form1.srchEdit.value='<%=srchEdit%>';
form1.srchType.value='<%=srchType%>';    
</script>
<form>
<input type="text" name="srchEdit"/>
<input type="text" name="srchType"/></form>
与<form>
<input type="text" name="srchEdit"/>
<input type="text" name="srchType"/>
</form>
<script>
form1.srchEdit.value='<%=srchEdit%>';
form1.srchType.value='<%=srchType%>';    
</script>
的差别,必须在form加载完对它赋值,否则srchEdit又重新加载,为null

3、hibernate属性设置出现错误:
      如果pojo类取fSUnit属性名,系统将无法识别。get和set将取不到值。

posted @ 2006-05-11 10:06 aimy 阅读(308) | 评论 (0)编辑 收藏
5-8
昨天晚上我给他讲了英文笑话,虽然他指出了很多错误,但那是个好的开始。
     A redneck bought a tickect and won the lottery.
     He went to claim it .He said:"I want $20 million right now"
who verified his tickect number replied to him :"No,sir.It doesn't work this way.we give you $1 million today,you will get the rest spread on for the next 19 years."
     The redneck said:"I want all my money.I won it,and i want it"
      The man had to explained to him patiently:"you would get $1 million,and the rest during the next 19 years."
      The redneck ,furious with the man ,screamed out:"I want all my money.If you don't give  me all my money ,i want my dollar back!"
注意读音:money、million、battle zone。

我的叔叔silas   H.E.Bates
      我的叔叔silas  活了九十五岁,有充足的时间去尝试很多事情.他一度做过掘墓人.
      In a life of 95 years ,my uncle found time to try most things, there was a time he become a gravedigger.
posted @ 2006-05-09 14:34 aimy 阅读(109) | 评论 (0)编辑 收藏

1、get是从服务器上取得数据,post是向服务器上传送数据。
2、get是将参数数据队列(表单)加到提交表单的action所指定的url中,值和表单的各个字段是相互对应的,Get将表单中数据的按照variable=value的形式,添加到action所指向的URL后面,并且两者使用“?”连接,而各个变量之间使用“&”连接,在url中是可以看见的,
post是将表单各个字段放在http header内一起传送到action中的URL中,
3、get,服务器通过request.getQuery()获得对应的值;对于post,服务器通过request.getForm()表单的值。
4、get,传送的数据小,post,传送的数据大,上传文件一般用post
特别注意:
<form action="/GraAppInfo/GraAppInfo.do?method=UpList"  method="post">
<select name="srchType">
     <option value="0">名字</option>
     <option value="1">用人单位</option>
   </select>
   <input height="18" name="srchEdit" type="text" align="right">
  <input  type="submit" value="查询">

显示的URL:http://localhost:8080/GraAppInfo/GraAppInfo.do?method=UpList
<form action="/GraAppInfo/GraAppInfo.do?method=UpList"  method="get">
显示的URL:http://localhost:8080/GraAppInfo/GraAppInfo.do?srchType=0&srchEdit=da
可见post 会覆盖action中的参数,
5、中文用post传递不会出现乱码,用get传递会出现乱码
所以传到action后要通过
String srchEdit = new String(graForm.getSrchEdit().getBytes("iso8859-1"), "gb2312");
处理。
二、传到页面的值乱码

posted @ 2006-05-08 09:50 aimy 阅读(215) | 评论 (0)编辑 收藏
<props>
        <prop key="add*">PROPAGATION_REQUIRED</prop>
        <prop key="cancel*">PROPAGATION_REQUIRED</prop>
        <prop key="create*">PROPAGATION_REQUIRED</prop>
        <prop key="save*">PROPAGATION_REQUIRED</prop>
</props>
如果service层没有用这些字母开头命名,spring自动将它处理为默认的访问模式--PROPAGATION_REQUIRED,readOnly
如果在action直接调用dao层也不行,比如service.getbaseDAO.update(object)也会出现类似的错误,因为事务被拦截了,所以dao层的方法最好用protect,这样只有同一个包里的类可以调用它的方法。
posted @ 2006-04-30 14:37 aimy 阅读(84) | 评论 (0)编辑 收藏

MENUID UPMENUID MENUNAME MENUURL MENUSEQ LAYERLEVEL RIGHTCODE ISSHOW TABLETYPE STARTSTATE
 
 1083 1001 毕业生招聘 # 1 1 1083 1  
 1084 1083 毕业生申报 /GraAppInfo/GraAppInfo.do?method=graappinfolist 6 9 1084 1  

menuid 该层菜单的id  upmenuid 上一层菜单id  menuname 菜单名字
menuurl 该层菜单的地址(首层菜单为#,没有地址)
menuseq 该层菜单在上一层菜单的顺序
layerlevel 如果是最后一层的菜单为9,其他为1
rigntcode关联到权限表=menuid
idshow 是否显示

权限表:
RIGHTID RIGHTCODE ROLETYPE ROLEID DEPTID USERID MENUID FUNNAME
1084                1084              2                    2                  
                     0        0            1084           毕业生申报
rightid=menuid=rightcode,roletype,roleid

这是单位的菜单设置和权限设置(1000〈menuid〈2000)

2、人事单位内部的设置(4000〈munuid〈5000)
权限的设置通过页面来控制

posted @ 2006-04-30 11:19 aimy 阅读(144) | 评论 (0)编辑 收藏
为了在每个dao和service 类都能用到log,在basedaoimpl和baseserviceimpl都实现方法:
    public Log getLogger() {
        if (log == null) {
            log = LogFactory.getLog(this.getClass());
        }
        return log;
    }

在类中就可以调用log
this.getLogger

2、<input type="text" name="password">
与form的属性对应,password是大小分别。
posted @ 2006-04-25 18:07 aimy 阅读(125) | 评论 (0)编辑 收藏

public class EmployUnitBaseInfo
{   
 
    private long ID; //用人单位系统编号---逻辑主键
    private String unitCode; //用人单位代号--业务主键
}
1、    使用逻辑主键,分页比较方便
2、    有可能unitcode会改变,用id可以保证当unitcode改变时,这个实体还存在

{C5A4CCF8-A282-4700-A5F3-FA6A5246D9F2}0.jpg

在页面上必须返回workpost + demandid,,
pojo 中的demand类如下:只有以下属性的setter和getter
    private String usedNeedNum;
    private int unitId;
    private String demandInfo;
 private long ID;
    private String needNum;
    private String position;
必须再添加一个属性demandInfo,
而在另一个毕业生申报中又要如图上操作,,如何在service层向页面层传递这些信息(测试程序员(剩2需求数))
 public class DemandServiceImpl
    extends BaseServiceImpl implements DemandService{
    public List getDemandList(int unitId)
    {
          long demandId;
          int needNum;
          int usedNeedNum;
          int lastNum;
         
          String demandInfo;
          TRealDemandDAOImpl dao = (TRealDemandDAOImpl) this.getBaseDAO();
          List list = dao.getSpareDemandByUnitId(unitId);
          Iterator it = list.iterator();
          while(it.hasNext())
          {
              TRealDemand demand = (TRealDemand) it.next();
              demandId = demand.getID();
              needNum =  Integer.parseInt(demand.getNeedNum()); 
              usedNeedNum = Integer.parseInt(demand.getUsedNeedNum());
              if(needNum>usedNeedNum)
              {
                  lastNum = usedNeedNum-needNum;
                  demandInfo = demand.getPosition()+" 剩 " + lastNum +" 需求数 ";
              }
             
          }
          return list;
    }
}

在action层再通过以下代码向页面传递数据:

DemandService demandService = (DemandService) this.getBean("DemandService");
 request.setAttribute("demandList",demandService.findDemandListByUnitId(unitInfo.getID()));



4、注意DemandServiceImpl 是实现类,DemandService 是interface
DemandService demandService = (DemandService) this.getBean("DemandService");
和DemandServiceImpl demandService = (DemandServiceImpl) this.getBean("DemandService");

虽然两个的操作一样,但是demandService是接口但可以执行相应的操作,起到黑箱子的作用。

5、记得在action中添加一个实体时,要通过idcard取得sex和birthday的属性加到内存中(表相对应的pojo)

posted @ 2006-04-21 10:36 aimy 阅读(99) | 评论 (0)编辑 收藏