<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>licream&#039;s blog</title>
	<atom:link href="http://www.licream.net/feed" rel="self" type="application/rss+xml" />
	<link>http://www.licream.net</link>
	<description></description>
	<lastBuildDate>Thu, 29 Jul 2010 08:26:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>试试flv是否正常播放.无插件播放</title>
		<link>http://www.licream.net/flv.html/</link>
		<comments>http://www.licream.net/flv.html/#comments</comments>
		<pubDate>Fri, 23 Jul 2010 06:25:59 +0000</pubDate>
		<dc:creator>Licream</dc:creator>
				<category><![CDATA[影音娱乐]]></category>

		<guid isPermaLink="false">http://www.licream.net/?p=540</guid>
		<description><![CDATA[偷了xu老大里面的播放器..整到自已主题上啦 使用方法.把下面代码添加到funcation.php里面 function flvlink($atts,$content=null){ extract(shortcode_atts(array(&#34;auto&#34;=&#62;'0'),$atts)); return'&#60;embed src=&#34;'.get_bloginfo(&#34;template_url&#34;).'/swf/flvideo.swf?auto='.$auto.'&#38;flv='.$content.'&#34; menu=&#34;false&#34; quality=&#34;high&#34; wmode=&#34;transparent&#34; bgcolor=&#34;#ffffff&#34; width=&#34;545&#34; height=&#34;490&#34; name=&#34;flvideo&#34; align=&#34;middle&#34; allowScriptAccess=&#34;sameDomain&#34; allowFullScreen=&#34;false&#34; type=&#34;application/x-shockwave-flash&#34; pluginspage=&#34;http://www.adobe.com/go/getflashplayer_cn&#34; /&#62;'; } add_shortcode('flv','flvlink');]]></description>
			<content:encoded><![CDATA[<p> <img src='http://www.licream.net/wp-includes/images/smilies/icon_mrgreen.gif' alt=':mrgreen:' class='wp-smiley' /><br />
偷了xu老大里面的播放器..整到自已主题上啦</p>
<embed src="http://www.licream.net/wp-content/themes/ThrillingTheme/swf/flvideo.swf?auto=0&flv=http://f.youku.com/player/getFlvPath/sid/00_00/st/flv/fileid/02006404004ADBDD7AF658025912DF7006322E-A03D-4E16-8960-0E4F7FD9276D?K=1350709b15f7c392141047f0" menu="false" quality="high" wmode="transparent" bgcolor="#ffffff" width="545" height="600" name="flvideo" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer_cn" />
<p>使用方法.把下面代码添加到funcation.php里面</p>
<pre class="brush: php;">
function flvlink($atts,$content=null){
	extract(shortcode_atts(array(&quot;auto&quot;=&gt;'0'),$atts));
	return'&lt;embed src=&quot;'.get_bloginfo(&quot;template_url&quot;).'/swf/flvideo.swf?auto='.$auto.'&amp;flv='.$content.'&quot; menu=&quot;false&quot; quality=&quot;high&quot; wmode=&quot;transparent&quot; bgcolor=&quot;#ffffff&quot; width=&quot;545&quot; height=&quot;490&quot; name=&quot;flvideo&quot; align=&quot;middle&quot; allowScriptAccess=&quot;sameDomain&quot; allowFullScreen=&quot;false&quot; type=&quot;application/x-shockwave-flash&quot; pluginspage=&quot;http://www.adobe.com/go/getflashplayer_cn&quot; /&gt;';
}
add_shortcode('flv','flvlink');
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.licream.net/flv.html/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
<enclosure url="http://f.youku.com/player/getFlvPath/sid/00_00/st/flv/fileid/02006404004ADBDD7AF658025912DF7006322E-A03D-4E16-8960-0E4F7FD9276D?K=1350709b15f7c392141047f0" length="11868427" type="video/flv" />
		</item>
		<item>
		<title>通过注解实现注册功能Flex</title>
		<link>http://www.licream.net/flex-reg.html/</link>
		<comments>http://www.licream.net/flex-reg.html/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 01:09:14 +0000</pubDate>
		<dc:creator>Licream</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[blazeds]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://www.licream.net/%e9%80%9a%e8%bf%87%e6%b3%a8%e8%a7%a3%e5%ae%9e%e7%8e%b0%e6%b3%a8%e5%86%8c%e5%8a%9f%e8%83%bdflex.html/</guid>
		<description><![CDATA[１. 利用Eclipse新建一个Flex项目名叫：FBS 按步一下并按照下图配置信息，再点完成． ２. 切换到java ee视图环境下编写java类,后台代码 在src目录下分别新建三个包:entity,dao,service. 在entity包里新建一个UserInfo的实体类 在方法体内写三个变量．Id,name,pass. 按shift+alt+s键并为他们生成set,get方法． 在类上面定义注解:@Entity及@table 在变量的get方法上面(除了主键)添加@colume package entity; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table //定义表名，不指定名则默认为该类名 public class UserInfo { public int Id; public String Name; public String Pass; @Id //主键ID @GeneratedValue //自动增长属性 public int getId() { return Id; } public void setId(int id) [...]]]></description>
			<content:encoded><![CDATA[<p>１. 利用Eclipse新建一个Flex项目名叫：FBS</p>
<p><a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image0021.jpg"><img style="display: inline; border-width: 0px;" title="clip_image002" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image002_thumb1.jpg" border="0" alt="clip_image002" width="184" height="244" /></a></p>
<p>按步一下并按照下图配置信息，再点完成．</p>
<p><a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image0041.jpg"><img style="display: inline; border-width: 0px;" title="clip_image004" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image004_thumb1.jpg" border="0" alt="clip_image004" width="213" height="244" /></a></p>
<p>２. 切换到java ee视图环境下编写java类,后台代码</p>
<p><a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image0061.jpg"><img style="display: inline; border-width: 0px;" title="clip_image006" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image006_thumb1.jpg" border="0" alt="clip_image006" width="244" height="22" /></a></p>
<p>在src目录下分别新建三个包:entity,dao,service.</p>
<p><a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image0081.jpg"><img style="display: inline; border-width: 0px;" title="clip_image008" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image008_thumb1.jpg" border="0" alt="clip_image008" width="244" height="233" /></a></p>
<p><a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image0101.jpg"><img style="display: inline; border-width: 0px;" title="clip_image010" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image010_thumb1.jpg" border="0" alt="clip_image010" width="205" height="244" /></a></p>
<p>在entity包里新建一个UserInfo的实体类</p>
<p><a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image0121.jpg"><img style="display: inline; border-width: 0px;" title="clip_image012" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image012_thumb1.jpg" border="0" alt="clip_image012" width="229" height="244" /></a></p>
<p>在方法体内写三个变量．Id,name,pass. 按shift+alt+s键并为他们生成set,get方法．</p>
<p><a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image0141.jpg"><img style="display: inline; border-width: 0px;" title="clip_image014" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image014_thumb1.jpg" border="0" alt="clip_image014" width="212" height="244" /></a></p>
<p><a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image0161.jpg"><img style="display: inline; border-width: 0px;" title="clip_image016" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image016_thumb1.jpg" border="0" alt="clip_image016" width="244" height="152" /></a></p>
<p>在类上面定义注解:@Entity及@table</p>
<p>在变量的get方法上面(除了主键)添加@colume</p>
<pre class="brush: java;">
package entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table   //定义表名，不指定名则默认为该类名
public class UserInfo {
	public int Id;
	public String Name;
	public String Pass;
	@Id //主键ID
	@GeneratedValue //自动增长属性
	public int getId() {
		return Id;
	}
	public void setId(int id) {
		Id = id;
	}
	@Column //定义一个列属性
	public String getName() {
		return Name;
	}
	public void setName(String name) {
		Name = name;
	}
	@Column
	public String getPass() {
		return Pass;
	}
	public void setPass(String pass) {
		Pass = pass;
	}

}
</pre>
<p>上面是完整的UserInfo代码.该类我们已经写好了,现在定义一个Dao,我们采用HibernateDaoSupport来实现.我们先写一个DAO的基类.在里面自动注入sessionFactory.通过子类来继承它,则子类自动注入到sessionFactory的实现.</p>
<p>这是DAO基类代码:</p>
<pre class="brush: java;">
package dao;

import javax.annotation.Resource;

import org.hibernate.SessionFactory;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.stereotype.Repository;

public class SuperDao extends HibernateDaoSupport{

	@Resource(name = &quot;sessionFactory&quot;) //该注解意思是自动注入,指定名称为sessionFactory,要和xml里的名称一样
	public void setSessionFactoryOverride(SessionFactory sessionFactory) {
		super.setSessionFactory(sessionFactory);
	}

}
</pre>
<p>接下来我们声明一个UserInfoDao的接口.在里面写入要实现的方法</p>
<p><a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image0181.jpg"><img style="display: inline; border-width: 0px;" title="clip_image018" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image018_thumb1.jpg" border="0" alt="clip_image018" width="244" height="225" /></a></p>
<p>这是userInfoDao接口代码:</p>
<pre class="brush: java;"> package dao;

import java.util.List;

import entity.UserInfo;

public interface UserInfoDao {
	public void addUserInfo(UserInfo user);
	public List&lt;UserInfo&gt; findAll();
}
 </pre>
<p>建创一个UserInfoDaoImpl类来实现该接口的方法.并继续SuperDao基类.</p>
<p>这是UserInfoDaoImpl实现方法的代码(另个方法没去实现.添加功能通过了,其它功能以后再添加),实现了添加方法</p>
<pre class="brush: java;"> package dao;

import java.util.List;

import javax.annotation.Resource;

import org.hibernate.SessionFactory;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.stereotype.Repository;

import entity.UserInfo;
@Repository //表示持久层
public class UserInfoDaoImpl extends SuperDao implements UserInfoDao{

	@Override
	public void addUserInfo(UserInfo user) {
		this.getHibernateTemplate().save(user);

	}

	@Override
	public List&lt;UserInfo&gt; findAll() {
		// TODO Auto-generated method stub
		return null;
	}

}
</pre>
<p>现在我们需要创建服务类.与dao层类似.也是需要先定义一个接口.再实现接口的方法.再通过UserDao来调用持久层的方法.</p>
<p>这是UserInfoServiceImpl类代码:</p>
<pre class="brush: java;"> package service;

import java.util.List;

import javax.annotation.Resource;
import javax.persistence.TableGenerator;

import org.springframework.flex.remoting.RemotingDestination;
import org.springframework.flex.remoting.RemotingInclude;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import dao.UserInfoDao;
import entity.UserInfo;

@Service(&quot;UserInfoService&quot;)
// 表示该类为service层
@RemotingDestination(channels = { &quot;my-amf&quot; })
@Transactional
// 调用事务
public class UserInfoServiceImpl implements UserInfoService {

	@Resource
	UserInfoDao userInfoDao; // 声明UserInfoDao

	@Override
	@RemotingInclude
	public void addUserInfo(UserInfo user) {
		userInfoDao.addUserInfo(user);

	}

	@Override
	@RemotingInclude
	public List&lt;UserInfo&gt; findAll() {
		// TODO Auto-generated method stub
		return null;
	}

}
</pre>
<p>接下来.在src目录下创建一个来与数据库连接的数据源,hibernate.cfg.xml.可通过工具来生成.</p>
<p>以下是该xml代码.其中数据库名称,用户名,密码需要修改.使用mysql数据库.</p>
<pre class="brush: xml;"> &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE hibernate-configuration PUBLIC &quot;-//Hibernate/Hibernate Configuration DTD 3.0//EN&quot; &quot;http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd&quot;&gt;
&lt;hibernate-configuration&gt;
	&lt;session-factory&gt;
		&lt;property name=&quot;hibernate.dialect&quot;&gt;org.hibernate.dialect.MySQLDialect&lt;/property&gt;
		&lt;property name=&quot;hibernate.connection.driver_class&quot;&gt;com.mysql.jdbc.Driver&lt;/property&gt;
		&lt;property name=&quot;hibernate.connection.url&quot;&gt;jdbc:mysql://localhost:3306/hibernate&lt;/property&gt;
		&lt;property name=&quot;hibernate.connection.username&quot;&gt;root&lt;/property&gt;
		&lt;property name=&quot;hibernate.connection.password&quot;&gt;lds7617&lt;/property&gt;
		&lt;property name=&quot;hibernate.hbm2ddl.auto&quot;&gt;create&lt;/property&gt;
		&lt;property name=&quot;hibernate.show_sql&quot;&gt;true&lt;/property&gt;
		&lt;property name=&quot;hibernate.format_sql&quot;&gt;true&lt;/property&gt;
		&lt;property name=&quot;hibernate.current_session_context_class&quot;&gt;thread&lt;/property&gt;

		&lt;!-- 最大连接数 --&gt;
		&lt;property name=&quot;hibernate.c3p0.max_size&quot;&gt;20&lt;/property&gt;
		&lt;!-- 最小连接数 --&gt;
		&lt;property name=&quot;hibernate.c3p0.min_size&quot;&gt;5&lt;/property&gt;
		&lt;!-- 获得连接的超时时间,如果超过这个时间,会抛出异常，单位毫秒 --&gt;
		&lt;property name=&quot;hibernate.c3p0.timeout&quot;&gt;120&lt;/property&gt;
		&lt;!-- 最大的PreparedStatement的数量 --&gt;
		&lt;property name=&quot;hibernate.c3p0.max_statements&quot;&gt;100&lt;/property&gt;
		&lt;!-- 每隔120秒检查连接池里的空闲连接 ，单位是秒--&gt;
		&lt;property name=&quot;hibernate.c3p0.idle_test_period&quot;&gt;120&lt;/property&gt;
		&lt;!-- 当连接池里面的连接用完的时候，C3P0一下获取的新的连接数 --&gt;
		&lt;property name=&quot;hibernate.c3p0.acquire_increment&quot;&gt;2&lt;/property&gt;
		&lt;!-- 每次都验证连接是否可用 --&gt;
		&lt;property name=&quot;hibernate.c3p0.validate&quot;&gt;true&lt;/property&gt;

	&lt;/session-factory&gt;
&lt;/hibernate-configuration&gt;
</pre>
<p>接着在hibernateconfig.xml文件通过sessionFactory来注入数据源.并配置事务处理管理器</p>
<pre class="brush: xml;"> &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
	xmlns:security=&quot;http://www.springframework.org/schema/security&quot;
	xmlns:tx=&quot;http://www.springframework.org/schema/tx&quot; xmlns:aop=&quot;http://www.springframework.org/schema/aop&quot;
	xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:context=&quot;http://www.springframework.org/schema/context&quot;
	xsi:schemaLocation=&quot;
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
		http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd

http://www.springframework.org/schema/tx

http://www.springframework.org/schema/tx/spring-tx-3.0.xsd

http://www.springframework.org/schema/aop

http://www.springframework.org/schema/aop/spring-aop-3.0.xsd&quot;&gt;

	&lt;!--　定义注解形式SessionFactory --&gt;
	&lt;bean id=&quot;sessionFactory&quot;
		class=&quot;org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean&quot;&gt;
		&lt;!--　定义数据源文件　--&gt;
		&lt;property name=&quot;configLocation&quot; value=&quot;classpath:hibernate.cfg.xml&quot; /&gt;
		&lt;!--　定义扫描有Entity注解实体类　--&gt;
		&lt;property name=&quot;annotatedClasses&quot;&gt;
			&lt;list&gt;
				&lt;value&gt;entity.UserInfo&lt;/value&gt;
			&lt;/list&gt;
		&lt;/property&gt;
	&lt;/bean&gt;

	&lt;!--　配置事务管理　--&gt;
	&lt;bean id=&quot;txManager&quot;
		class=&quot;org.springframework.orm.hibernate3.HibernateTransactionManager&quot;&gt;
		&lt;property name=&quot;sessionFactory&quot; ref=&quot;sessionFactory&quot; /&gt;
	&lt;/bean&gt;
	&lt;tx:annotation-driven transaction-manager=&quot;txManager&quot; /&gt;

&lt;/beans&gt;
</pre>
<p>再找到daoconfig.xml和serviceconfig.xml配置文件修改相应的包名.daoconfig.xml对应的是dao包的路径,serviceconfig.xml对应的是service包的路径.</p>
<pre class="brush: xml;">
&lt;!--　自动扫描dao层有注解的类--&gt;
&lt;context:component-scan base-package=&quot;dao&quot; /&gt;
&lt;!--　自动扫描service层有注解的类--&gt;
&lt;context:component-scan base-package=&quot;service&quot; /&gt;
</pre>
<p>向flexconfig.xml配置信息添加启动注解支持及路径访问配置.这是flexconfig.xml代码.</p>
<pre class="brush: xml;"> &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
	xmlns:flex=&quot;http://www.springframework.org/schema/flex&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
	xsi:schemaLocation=&quot;

http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

http://www.springframework.org/schema/flex

http://www.springframework.org/schema/flex/spring-flex-1.0.xsd&quot;&gt;

	&lt;flex:message-broker&gt;
		&lt;flex:remoting-service default-channels=&quot;my-amf&quot; /&gt;
	&lt;/flex:message-broker&gt;

	&lt;!--  启动注解的支持--&gt;
	&lt;bean
		class=&quot;org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter&quot; /&gt;

&lt;/beans&gt;
</pre>
<p>对工程进行编译一次.确认没有错误.</p>
<p>接下来我们切换到flash视图环境下编写mxml文件.通过前台来调用后台的业务.</p>
<p>简单的设计下界面</p>
<p><a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image0201.jpg"><img style="display: inline; border-width: 0px;" title="clip_image020" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image020_thumb1.jpg" border="0" alt="clip_image020" width="244" height="122" /></a></p>
<p>对注册按钮右键点击生成服务调用功能:</p>
<p><a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image0221.jpg"><img style="display: inline; border-width: 0px;" title="clip_image022" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image022_thumb1.jpg" border="0" alt="clip_image022" width="155" height="244" /></a></p>
<p>选择BlazeDS服务.并钩选不需要密码.点下一步.会出现该错误.</p>
<p><a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image0241.jpg"><img style="display: inline; border-width: 0px;" title="clip_image024" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image024_thumb1.jpg" border="0" alt="clip_image024" width="244" height="62" /></a></p>
<p>解决方法:找到该工程目录下. .flexProperties文件.打开他.修改serverContextRoot=&#8221;/WebRoot&#8221;参数为项目名serverContextRoot=&#8221;/FBS&#8221; .修改完成生记得刷新一下工程.才能生效.</p>
<p>下一步可以看到我们通过注解公开的bean.</p>
<p>钩选我们要使用的.UserInfoService,并完成</p>
<p><a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image0261.jpg"><img style="display: inline; border-width: 0px;" title="clip_image026" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image026_thumb1.jpg" border="0" alt="clip_image026" width="244" height="241" /></a></p>
<p>再右键注册按钮来生成服务调用,刚才的步骤是新建服务,现在是用生成好的服务利用组件来调用它们.</p>
<p><a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image0281.jpg"><img style="display: inline; border-width: 0px;" title="clip_image028" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image028_thumb1.jpg" border="0" alt="clip_image028" width="244" height="139" /></a>我们选择addUserInfo方法.</p>
<p>对生成好的事件进行修改:</p>
<pre class="brush: jscript;">
var userInfoFlex:UserInfo=new UserInfo();
				userInfoFlex.Name=txtname.text;
				userInfoFlex.pass=txtpass.text;
				addUserInfoResult.token = userInfoService.addUserInfo(userInfoFlex); </pre>
<p>还需要为该事件定义路径:</p>
<p>修改如下代码:</p>
<pre class="brush: jscript;">
		&lt;services:UserInfoService id=&quot;userInfoService&quot; fault=&quot;Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)&quot; showBusyCursor=&quot;true&quot;&gt;
			&lt;services:channelSet&gt;
				&lt;s:ChannelSet&gt;
					&lt;s:AMFChannel url=&quot;http://localhost:8080/FBS/messagebroker/amf&quot;/&gt;
				&lt;/s:ChannelSet&gt;
			&lt;/services:channelSet&gt;

		&lt;/services:UserInfoService&gt;
</pre>
<p>这样算简单的配置完成了.如果发现flex_src目录下有文件错误.一般都是因为有重复的代码造成的.删除多余的就可以了.</p>
<p><a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image0301.jpg"><img style="display: inline; border-width: 0px;" title="clip_image030" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image030_thumb1.jpg" border="0" alt="clip_image030" width="244" height="138" /></a>删除有红色X的方法体.他们是因为有重复的方法了</p>
<p>再重新编译一次..</p>
<p>右键主模块FBS.mxml 运行</p>
<p><a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image0321.jpg"><img style="display: inline; border-width: 0px;" title="clip_image032" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image032_thumb1.jpg" border="0" alt="clip_image032" width="244" height="74" /></a></p>
<p>如果发现该文件出现404错误,需为工程设置路径.右键工程.&#8211;&gt;属性àflex构建路径.右下角修改为: <a href="http://localhost:8080/FBS/">http://localhost:8080/FBS/</a></p>
<p><a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image0341.jpg"><img style="display: inline; border-width: 0px;" title="clip_image034" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image034_thumb1.jpg" border="0" alt="clip_image034" width="244" height="222" /></a></p>
<p>结果发现有空值针异常.null.</p>
<p>经过检验,发现在UserInfoServiceImpl里的UserInfoDao没有注入给UserInfoServiceImpl.所以会引发这问题.解决的方法是在UserInfoDao上面添加</p>
<pre class="brush: java;">
 @Resource
 UserInfoDao userInfoDao; //声明UserInfoDao
</pre>
<p>成功添加数据:</p>
<p><a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image036.jpg"><img style="display: inline; border-width: 0px;" title="clip_image036" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image036_thumb.jpg" border="0" alt="clip_image036" width="244" height="24" /></a></p>
<p>一个简单的注册功能完成了</p>
]]></content:encoded>
			<wfw:commentRss>http://www.licream.net/flex-reg.html/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>更新flex+spring+hibernate通过注解改良实现</title>
		<link>http://www.licream.net/flex_spring_hibernate.html/</link>
		<comments>http://www.licream.net/flex_spring_hibernate.html/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 00:43:43 +0000</pubDate>
		<dc:creator>Licream</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[hibernate.web]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://www.licream.net/?p=432</guid>
		<description><![CDATA[看到官方网上的视频做的例子是通过注解来实现.减少了配置文件代码.我觉得这功能非常不错,经过自已一些测试实验.最终做出点像样的东西了.0 0.额. 下载了官方最新的BlazeDS.war.自已在里面添加了一些hibernate核心包及注解包.版本为.hbiernate3.spring3.flex4.添加了几个配置5个配置文件.和一些必需的相关代码.. 我现在一一的贴上来吧: application-config.xml,主要是引入其它配置文件信息. &#60;?xml version=&#34;1.0&#34; encoding=&#34;UTF-8&#34;?&#62; &#60;beans xmlns=&#34;http://www.springframework.org/schema/beans&#34; xmlns:security=&#34;http://www.springframework.org/schema/security&#34; xmlns:tx=&#34;http://www.springframework.org/schema/tx&#34; xmlns:aop=&#34;http://www.springframework.org/schema/aop&#34; xmlns:xsi=&#34;http://www.w3.org/2001/XMLSchema-instance&#34; xmlns:context=&#34;http://www.springframework.org/schema/context&#34; xsi:schemaLocation=&#34; http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd&#34;&#62; &#60;import resource=&#34;flexconfig.xml&#34; /&#62; &#60;import resource=&#34;hibernateconfig.xml&#34; /&#62; &#60;import resource=&#34;daoconfig.xml&#34; /&#62; &#60;import resource=&#34;serviceconfig.xml&#34; /&#62; &#60;/beans&#62; daoconfig.xml:扫描Dao层包里有注解的类. &#60;?xml version=&#34;1.0&#34; encoding=&#34;UTF-8&#34;?&#62; &#60;beans xmlns=&#34;http://www.springframework.org/schema/beans&#34; xmlns:security=&#34;http://www.springframework.org/schema/security&#34; xmlns:xsi=&#34;http://www.w3.org/2001/XMLSchema-instance&#34; xmlns:context=&#34;http://www.springframework.org/schema/context&#34; xsi:schemaLocation=&#34; http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd&#34;&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>看到官方网上的视频做的例子是通过注解来实现.减少了配置文件代码.我觉得这功能非常不错,经过自已一些测试实验.最终做出点像样的东西了.0 0.额.<br />
下载了官方最新的BlazeDS.war.自已在里面添加了一些hibernate核心包及注解包.版本为.hbiernate3.spring3.flex4.添加了几个配置5个配置文件.和一些必需的相关代码..<br />
我现在一一的贴上来吧:<br />
application-config.xml,主要是引入其它配置文件信息.</p>
<pre class="brush: xml;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
	xmlns:security=&quot;http://www.springframework.org/schema/security&quot;
	xmlns:tx=&quot;http://www.springframework.org/schema/tx&quot; xmlns:aop=&quot;http://www.springframework.org/schema/aop&quot;
	xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:context=&quot;http://www.springframework.org/schema/context&quot;
	xsi:schemaLocation=&quot;
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
		http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd

http://www.springframework.org/schema/tx

http://www.springframework.org/schema/tx/spring-tx-3.0.xsd

http://www.springframework.org/schema/aop

http://www.springframework.org/schema/aop/spring-aop-3.0.xsd&quot;&gt;

	&lt;import resource=&quot;flexconfig.xml&quot; /&gt;
	&lt;import resource=&quot;hibernateconfig.xml&quot; /&gt;
	&lt;import resource=&quot;daoconfig.xml&quot; /&gt;
	&lt;import resource=&quot;serviceconfig.xml&quot; /&gt;

&lt;/beans&gt;
</pre>
<p>daoconfig.xml:扫描Dao层包里有注解的类.</p>
<pre class="brush: xml;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
	xmlns:security=&quot;http://www.springframework.org/schema/security&quot;
	xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:context=&quot;http://www.springframework.org/schema/context&quot;
	xsi:schemaLocation=&quot;
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
		http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd&quot;&gt;
	&lt;!--　自动扫描dao层有注解的类--&gt;
	&lt;context:component-scan base-package=&quot;dao&quot; /&gt;

&lt;/beans&gt;
</pre>
<p>serviceconfig.xml与dao层的配置文件一样.是扫描service层的</p>
<pre class="brush: xml;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
	xmlns:security=&quot;http://www.springframework.org/schema/security&quot;
	xmlns:tx=&quot;http://www.springframework.org/schema/tx&quot; xmlns:aop=&quot;http://www.springframework.org/schema/aop&quot;
	xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:context=&quot;http://www.springframework.org/schema/context&quot;
	xsi:schemaLocation=&quot;
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
		http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd

http://www.springframework.org/schema/tx

http://www.springframework.org/schema/tx/spring-tx-3.0.xsd

http://www.springframework.org/schema/aop

http://www.springframework.org/schema/aop/spring-aop-3.0.xsd&quot;&gt;

	&lt;!--　自动扫描service层有注解的类--&gt;
	&lt;context:component-scan base-package=&quot;service&quot; /&gt;
&lt;/beans&gt;
</pre>
<p>flexconfig.xml 对flex一些信息处理.</p>
<pre class="brush: xml;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
	xmlns:flex=&quot;http://www.springframework.org/schema/flex&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
	xsi:schemaLocation=&quot;

http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

http://www.springframework.org/schema/flex

http://www.springframework.org/schema/flex/spring-flex-1.0.xsd&quot;&gt;

	&lt;flex:message-broker&gt;
		&lt;flex:remoting-service default-channels=&quot;my-amf&quot; /&gt;
	&lt;/flex:message-broker&gt;

	&lt;!--  启动注解的支持--&gt;
	&lt;bean
		class=&quot;org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter&quot; /&gt;

&lt;/beans&gt;
</pre>
<p>hibernateconfig.xml:配置数据源及sessionFactory和事务处理.</p>
<pre class="brush: xml;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
	xmlns:security=&quot;http://www.springframework.org/schema/security&quot;
	xmlns:tx=&quot;http://www.springframework.org/schema/tx&quot; xmlns:aop=&quot;http://www.springframework.org/schema/aop&quot;
	xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:context=&quot;http://www.springframework.org/schema/context&quot;
	xsi:schemaLocation=&quot;
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
		http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd

http://www.springframework.org/schema/tx

http://www.springframework.org/schema/tx/spring-tx-3.0.xsd

http://www.springframework.org/schema/aop

http://www.springframework.org/schema/aop/spring-aop-3.0.xsd&quot;&gt;

	&lt;!--　定义注解形式SessionFactory --&gt;
	&lt;bean id=&quot;sessionFactory&quot;
		class=&quot;org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean&quot;&gt;
		&lt;!--　定义数据源文件　--&gt;
		&lt;property name=&quot;configLocation&quot; value=&quot;classpath:hibernate.cfg.xml&quot; /&gt;
		&lt;!--　定义扫描有Entity注解实体类　--&gt;
		&lt;property name=&quot;annotatedClasses&quot;&gt;
			&lt;list&gt;
				&lt;value&gt;entity.UserInfo&lt;/value&gt;
			&lt;/list&gt;
		&lt;/property&gt;
	&lt;/bean&gt;

	&lt;!--　配置事务管理　--&gt;
	&lt;bean id=&quot;txManager&quot;
		class=&quot;org.springframework.orm.hibernate3.HibernateTransactionManager&quot;&gt;
		&lt;property name=&quot;sessionFactory&quot; ref=&quot;sessionFactory&quot; /&gt;
	&lt;/bean&gt;
	&lt;tx:annotation-driven transaction-manager=&quot;txManager&quot; /&gt;
&lt;/beans&gt;
</pre>
<p>配置web.xml代码为:</p>
<pre class="brush: xml;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE web-app PUBLIC &quot;-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN&quot; &quot;http://java.sun.com/dtd/web-app_2_3.dtd&quot;&gt;
&lt;web-app&gt;

	&lt;display-name&gt;FBS&lt;/display-name&gt;
	&lt;description&gt;BlazeDS Application&lt;/description&gt;

	&lt;context-param&gt;
		&lt;param-name&gt;flex.class.path&lt;/param-name&gt;
		&lt;param-value&gt;/WEB-INF/flex/hotfixes,/WEB-INF/flex/jars&lt;/param-value&gt;
	&lt;/context-param&gt;

	&lt;!-- Http Flex Session attribute and binding listener support --&gt;
	&lt;listener&gt;
		&lt;listener-class&gt;flex.messaging.HttpFlexSession&lt;/listener-class&gt;
	&lt;/listener&gt;

	&lt;servlet&gt;
		&lt;servlet-name&gt;RDSDispatchServlet&lt;/servlet-name&gt;
		&lt;display-name&gt;RDSDispatchServlet&lt;/display-name&gt;
		&lt;servlet-class&gt;flex.rds.server.servlet.FrontEndServlet&lt;/servlet-class&gt;
		&lt;init-param&gt;
			&lt;param-name&gt;messageBrokerId&lt;/param-name&gt;
			&lt;param-value&gt;_messageBroker&lt;/param-value&gt;
		&lt;/init-param&gt;
		&lt;init-param&gt;
			&lt;param-name&gt;useAppserverSecurity&lt;/param-name&gt;
			&lt;param-value&gt;false&lt;/param-value&gt;
		&lt;/init-param&gt;
		&lt;load-on-startup&gt;10&lt;/load-on-startup&gt;
	&lt;/servlet&gt;

	&lt;!-- MessageBroker Servlet --&gt;
	&lt;servlet&gt;
		&lt;servlet-name&gt;MessageBrokerServlet&lt;/servlet-name&gt;
		&lt;servlet-class&gt;flex.messaging.MessageBrokerServlet&lt;/servlet-class&gt;
		&lt;init-param&gt;
			&lt;param-name&gt;services.configuration.file&lt;/param-name&gt;
			&lt;param-value&gt;/WEB-INF/flex/services-config.xml&lt;/param-value&gt;
		&lt;/init-param&gt;
		&lt;init-param&gt;
			&lt;param-name&gt;flex.write.path&lt;/param-name&gt;
			&lt;param-value&gt;/WEB-INF/flex&lt;/param-value&gt;
		&lt;/init-param&gt;
		&lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
	&lt;/servlet&gt;

	&lt;servlet&gt;
		&lt;servlet-name&gt;Spring MVC Dispatcher Servlet&lt;/servlet-name&gt;
		&lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
		&lt;init-param&gt;
			&lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
			&lt;param-value&gt;/WEB-INF/config/*-config.xml&lt;/param-value&gt;
		&lt;/init-param&gt;
		&lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
	&lt;/servlet&gt;

	&lt;servlet-mapping id=&quot;RDS_DISPATCH_MAPPING&quot;&gt;
		&lt;servlet-name&gt;RDSDispatchServlet&lt;/servlet-name&gt;
		&lt;url-pattern&gt;/CFIDE/main/ide.cfm&lt;/url-pattern&gt;
	&lt;/servlet-mapping&gt;

	&lt;servlet-mapping&gt;
		&lt;servlet-name&gt;MessageBrokerServlet&lt;/servlet-name&gt;
		&lt;url-pattern&gt;/messagebroker/*&lt;/url-pattern&gt;
	&lt;/servlet-mapping&gt;

	&lt;!-- Map /spring/* requests to the DispatcherServlet --&gt;
	&lt;servlet-mapping&gt;
		&lt;servlet-name&gt;Spring MVC Dispatcher Servlet&lt;/servlet-name&gt;
		&lt;url-pattern&gt;/messagebroker/*&lt;/url-pattern&gt;
	&lt;/servlet-mapping&gt;

	&lt;welcome-file-list&gt;
		&lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
		&lt;welcome-file&gt;index.htm&lt;/welcome-file&gt;
	&lt;/welcome-file-list&gt;

	&lt;!-- for WebSphere deployment, please uncomment --&gt;
	&lt;!--
		&lt;resource-ref&gt;
		&lt;description&gt;Flex Messaging WorkManager&lt;/description&gt;
		&lt;res-ref-name&gt;wm/MessagingWorkManager&lt;/res-ref-name&gt;
		&lt;res-type&gt;com.ibm.websphere.asynchbeans.WorkManager&lt;/res-type&gt;
		&lt;res-auth&gt;Container&lt;/res-auth&gt;
		&lt;res-sharing-scope&gt;Shareable&lt;/res-sharing-scope&gt;
	&lt;/resource-ref&gt;
	--&gt;

&lt;/web-app&gt;
</pre>
<p>以上的代码基本是通用的.只需修改上面的路径就可以了.通过web.xml里面定义的过滤器来调用application-config.xml即可.<br />
自已也修改了一份blazeds.war..添加了上面的信息..集成好了的.如果有需要的可以发我邮箱索要.因为20多M..上传到空间不忍心哈..</p>
]]></content:encoded>
			<wfw:commentRss>http://www.licream.net/flex_spring_hibernate.html/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Flex+Spring整合详细流程 绝对正常运行</title>
		<link>http://www.licream.net/flexspring.html/</link>
		<comments>http://www.licream.net/flexspring.html/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 18:44:41 +0000</pubDate>
		<dc:creator>Licream</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://www.licream.net/flexspring%e6%95%b4%e5%90%88%e8%af%a6%e7%bb%86%e6%b5%81%e7%a8%8b-%e7%bb%9d%e5%af%b9%e6%ad%a3%e5%b8%b8%e8%bf%90%e8%a1%8c.html/</guid>
		<description><![CDATA[经过二周反复的新建删除新建删除重复的工作.现在终于有点成果了.对flex不了解.用了这么长时间才把他们整合好了.哎..其间碰到各种问题,真是郁闷死. 先把flex+spring发上来吧.hibernate还没完美整合上来- -. 我用文档写好了.我就直接贴上来自已也算在这备份一次.HOHO 1. Flex +Spring整合方法 i. 准备工具Eclipse,BlazeDS,Spring,Tomcat. 1. 使用Eclipse3.5 +flex builder 4 pulgin+Spring3.0+Tomcat6.0+JDK6.0+ BlazeDS 2. 下载地址: 3. Flex Builder 4: http://www.adobe.com/ 4. Eclipse: http://www.eclipse.org/downloads/ 5. Spring3.0: http://www.springsource.org/download 6. Tomcat6.0: http://tomcat.apache.org/download-60.cgi 7. JDK6.0: http://java.sun.com/javase/downloads/index.jsp 2. 创建HelloWorld工程 i. 打开Eclipse,打开文件菜单,选择Flex项目. 3. 4. 定义项目名称为HelloWorld.应用类型为j2ee web形式,远程服务选用BlazeDS(简洁又免费),我们是把flex+java项目整合在一个项目工程里面.所以要钩选:使用WTP创建java/flex组合项目. 5. 6. 在目标运行时后面那按钮点开他新建一个Tomcat服务.选中Tomcat V6.0.然后完成.回到新建工程第二部,选择刚才建的tomcat服务名称. 7. 8. 指定blazeDS文件路径.在输入文件夹名称修改为:WebRoot与内容文件夹同名.,这样就可以完成了工程的创建! 9. 10. 补充下,我使用的blazeDS是最新版.自带很多JAR包及spring3.0包..还有web.xml.项目已经建完了,我们还需要配置一下.双击服务器.把我们刚新建的工程添加到tomcat模块里.点确定. 11. 12. [...]]]></description>
			<content:encoded><![CDATA[<p>经过二周反复的新建删除新建删除重复的工作.现在终于有点成果了.对flex不了解.用了这么长时间才把他们整合好了.哎..其间碰到各种问题,真是郁闷死. 先把flex+spring发上来吧.hibernate还没完美整合上来- -.</p>
<p>我用文档写好了.我就直接贴上来自已也算在这备份一次.HOHO</p>
<p>1. Flex +Spring整合方法</p>
<p>i. 准备工具Eclipse,BlazeDS,Spring,Tomcat.</p>
<p>1. 使用Eclipse3.5 +flex builder 4 pulgin+Spring3.0+Tomcat6.0+JDK6.0+ BlazeDS</p>
<p>2. 下载地址:</p>
<p>3. Flex Builder 4: http://www.adobe.com/</p>
<p>4. Eclipse: <a href="http://www.eclipse.org/downloads/">http://www.eclipse.org/downloads/</a></p>
<p>5. Spring3.0: <a href="http://www.springsource.org/download">http://www.springsource.org/download</a></p>
<p>6. Tomcat6.0: <a href="http://tomcat.apache.org/download-60.cgi">http://tomcat.apache.org/download-60.cgi</a></p>
<p>7. JDK6.0: <a href="http://java.sun.com/javase/downloads/index.jsp">http://java.sun.com/javase/downloads/index.jsp</a></p>
<p>2. 创建HelloWorld工程</p>
<p>i. 打开Eclipse,打开文件菜单,选择Flex项目.</p>
<p>3. <a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image002.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image002_thumb.jpg" width="191" height="244" /></a></p>
<p>4. 定义项目名称为HelloWorld.应用类型为j2ee web形式,远程服务选用BlazeDS(简洁又免费),我们是把flex+java项目整合在一个项目工程里面.所以要钩选:使用WTP创建java/flex组合项目.</p>
<p>5. <a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image004.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image004" border="0" alt="clip_image004" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image004_thumb.jpg" width="224" height="244" /></a></p>
<p>6. 在目标运行时后面那按钮点开他新建一个Tomcat服务.选中Tomcat V6.0.然后完成.回到新建工程第二部,选择刚才建的tomcat服务名称.</p>
<p>7. <a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image006.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image006" border="0" alt="clip_image006" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image006_thumb.jpg" width="244" height="209" /></a> <a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image008.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image008" border="0" alt="clip_image008" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image008_thumb.jpg" width="214" height="244" /></a></p>
<p>8. 指定blazeDS文件路径.在输入文件夹名称修改为:WebRoot与内容文件夹同名.,这样就可以完成了工程的创建!</p>
<p>9. <a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image010.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image010" border="0" alt="clip_image010" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image010_thumb.jpg" width="208" height="244" /></a></p>
<p>10. 补充下,我使用的blazeDS是最新版.自带很多JAR包及spring3.0包..还有web.xml.项目已经建完了,我们还需要配置一下.双击服务器.把我们刚新建的工程添加到tomcat模块里.点确定.</p>
<p>11. <a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image012.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image012" border="0" alt="clip_image012" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image012_thumb.jpg" width="244" height="73" /></a></p>
<p>12. <a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image014.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image014" border="0" alt="clip_image014" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image014_thumb.jpg" width="244" height="180" /></a></p>
<p>13. 再右键工程名打开属性: 在flex构建路径下的输出文件夹URL设置为:http://localhost:8080/项目名/.记得一定要在项目名后面加正斜杠.基本配置完成!</p>
<p>14. <a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image016.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image016" border="0" alt="clip_image016" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image016_thumb.jpg" width="244" height="232" /></a></p>
<p>15. 在项目WEB-INF目录下新建一个存放xml文件夹.主要用来存放spring,hibernate及其它扩展xml信息文件.方便管理而已,项目结构如下:</p>
<p>16. <a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image018.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image018" border="0" alt="clip_image018" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image018_thumb.jpg" width="219" height="244" /></a></p>
<p>17. <a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image020.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image020" border="0" alt="clip_image020" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image020_thumb.jpg" width="125" height="244" /></a></p>
<p>18. 复制下面代码到application-config.xml(该文件负责的功能是spring配置信息)</p>
<pre class="brush: xml;"> 	&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; 	&lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
	xmlns:security=&quot;http://www.springframework.org/schema/security&quot;
	xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:context=&quot;http://www.springframework.org/schema/context&quot;
	xsi:schemaLocation=&quot;
	http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
	http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd
	http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd&quot;&gt;  	&lt;/beans&gt; </pre>
<p>22. 复制下面代码到dispatchservlet-config.xml文件里面(该文件负责blazeDS远程公开服务.采用注解方式,优点是减少xml的配置信息.)</p>
<pre class="brush: xml;"> 	&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; 	&lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
	xmlns:flex=&quot;http://www.springframework.org/schema/flex&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
	xsi:schemaLocation=&quot;

http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

http://www.springframework.org/schema/flex

	http://www.springframework.org/schema/flex/spring-flex-1.0.xsd&quot;&gt;	 	&lt;/beans&gt; </pre>
<p>26. 现在我们建个java 类,命名为Test.</p>
<pre class="brush: java;"> 	@Service(&quot;test&quot;)  	@RemotingDestination(channels={&quot;my-amf&quot;}) 	public class Test { 	@RemotingInclude 	public String say(String name){ 	return &quot;欢迎加入&quot;+name; 		} </pre>
<p>31. 回到application-config.xml文件向里面添加这二条代码:</p>
<p>a) &lt;context:annotation-config /&gt;&lt;!&#8211; 隐式地向 Spring 容器注册 &#8211;&gt;</p>
<p>b) &lt;context:component-scan base-package=<i>&quot;test&quot;</i> /&gt;&lt;!&#8211; 自动扫描指定包目录下所有在注解代码的java类 &#8211;&gt;</p>
<p>32. 回到dispatchservlet-config.xml文件向里面添加这段代码:</p>
<p>i. &lt;flex:message-broker&gt;</p>
<p>1. &lt;flex:remoting-service default-channels=<i>&quot;my-amf&quot;</i> /&gt;</p>
<p>ii. &lt;/flex:message-broker&gt;</p>
<p>33. 回到web.xml文件.把里面的</p>
<p>34. &lt;param-name&gt;useAppserverSecurity&lt;/param-name&gt;</p>
<p>1. &lt;param-value&gt; false &lt;/param-value&gt;&lt;!&#8211; 改成false &#8211;&gt;这样可以不用密码来有使用数据服务.</p>
<p>35. 记录修改配置文件路径.</p>
<p>a) &lt;context-param&gt;</p>
<p>i. &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;</p>
<p>ii. &lt;param-value&gt;/WEB-INF/config/*-config.xml&lt;/param-value&gt;</p>
<p>b) &lt;/context-param&gt;</p>
<p>36. 运行之后不知为什么会提示没有flex-servlet.xml这个文件.那我就在web.xml同目录下新建一个好了哈.</p>
<p>37. 添加代码到该文件下:</p>
<pre class="brush: xml;"> 	&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; 	&lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
	xmlns:flex=&quot;http://www.springframework.org/schema/flex&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
	xsi:schemaLocation=&quot;

http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

http://www.springframework.org/schema/flex

	http://www.springframework.org/schema/flex/spring-flex-1.0.xsd&quot;&gt;  	&lt;/beans&gt; </pre>
<p>41. 其实可以把另二个配置文件的信息都加到这里面来.我前面已经配置好了.所以这个就空在这.留个备用.呵呵,具体看不出web.xml哪条信息要读取这文件的.不知是不是系统定义的.</p>
<p>42. 用Tomcat启动项目后,切换到flash工程环境下.在数据服务标签下有个连接数据/服务功能.使用他我们可以用blazeds对后台进行通信,钩选不需要密码.点下一步会出现如下错误. <a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image022.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image022" border="0" alt="clip_image022" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image022_thumb.jpg" width="244" height="71" /></a><a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image024.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image024" border="0" alt="clip_image024" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image024_thumb.jpg" width="244" height="61" /></a></p>
<p>43. 解决的办法:找到工程目录下的.flexProperties文件.修改上下文配置(意思大概是这样吧) serverContextRoot=&quot;/WebRoot&quot;修改为serverContextRoot=&quot;/HelloWorld&quot;.一定要改成项目名称.随后刷新工程.再连接数据服务.</p>
<p>44. 我们先来测试下能不能正常读到后右的数据.钩选要读取的信息.如多个类文件则会显示多个services配置信息名称.我们选中test.下面二条输入框为默认.</p>
<p>45. <a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image026.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image026" border="0" alt="clip_image026" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image026_thumb.jpg" width="238" height="244" /></a></p>
<p>46. 建好之后在数据服务标签栏上找到如下图标.来测试数据是否正常通信. <a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image028.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image028" border="0" alt="clip_image028" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image028_thumb.jpg" width="97" height="58" /></a></p>
<p>47. <a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image030.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image030" border="0" alt="clip_image030" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image030_thumb.jpg" width="237" height="244" /></a></p>
<p>48. 嗯,测试成功了.说明我们之前的配置信息是没有问题了.能正常跟后台通信了.</p>
<p>49. 接下来我们切换到flash视图环境下编辑mxml主文件.添加二个组件.一个输入框及文本组件.</p>
<p>50. 添加如下代码在非可视标签下&lt;:fx:Declarations&gt;</p>
<pre class="brush: xml;"> 	&lt;s:CallResponder id=&quot;sayResult&quot;/&gt; 	&lt;services:Test destination=&quot;test&quot;&gt;  &lt;!--要与java类名称一致--&gt; 	&lt;services:channelSet&gt; 	&lt;s:ChannelSet&gt; 	&lt;s:AMFChannel url=&quot;http://localhost:8080/HelloWorld/messagebroker/amf&quot;/&gt; 	&lt;/s:ChannelSet&gt; 	&lt;/services:channelSet&gt; 	&lt;/services:Test&gt;&lt;!--上面的写法有点别扭,但一定是要这样写的.--&gt; </pre>
<p>52. 接下来我们把数据绑定在组件上,最终代码如下.button纯属自已多余添加的可不看-..</p>
<p>53. <a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image032.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image032" border="0" alt="clip_image032" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image032_thumb.jpg" width="244" height="161" /></a></p>
<p>54. <a href="http://www.licream.net/wp-content/uploads/2010/07/clip_image034.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image034" border="0" alt="clip_image034" src="http://www.licream.net/wp-content/uploads/2010/07/clip_image034_thumb.jpg" width="244" height="204" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.licream.net/flexspring.html/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>交费了,..晕</title>
		<link>http://www.licream.net/392.html/</link>
		<comments>http://www.licream.net/392.html/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 01:13:06 +0000</pubDate>
		<dc:creator>Licream</dc:creator>
				<category><![CDATA[生活杂记]]></category>

		<guid isPermaLink="false">http://www.licream.net/?p=392</guid>
		<description><![CDATA[快二个月了没有更新,上个月空间到期.这段时间真忙,一直不把这当会事.呵呵. 主题开始出异常,经常抽风不能正常显示信息.暂时用默认的好了.]]></description>
			<content:encoded><![CDATA[<p>快二个月了没有更新,上个月空间到期.这段时间真忙,一直不把这当会事.呵呵.</p>
<p>主题开始出异常,经常抽风不能正常显示信息.暂时用默认的好了.</p>
<p><a rel="thickbox" href="http://www.licream.net/wp-content/uploads/2010/07/12.jpg"><img class="alignnone size-medium wp-image-475" title="12" src="http://www.licream.net/wp-content/uploads/2010/07/12-300x225.jpg" alt="" width="300" height="225" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.licream.net/392.html/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>浅谈组件映射</title>
		<link>http://www.licream.net/one-many.html/</link>
		<comments>http://www.licream.net/one-many.html/#comments</comments>
		<pubDate>Tue, 04 May 2010 13:28:15 +0000</pubDate>
		<dc:creator>Licream</dc:creator>
				<category><![CDATA[Hibernate]]></category>

		<guid isPermaLink="false">http://www.licream.net/%e6%b5%85%e8%b0%88%e7%bb%84%e4%bb%b6%e6%98%a0%e5%b0%84.html/</guid>
		<description><![CDATA[hibernate中的关联映射主要有三种:一对一,一对多(多对一),多对多.它们都 可以分为单向和双向双种. 凡是双向关联必设mappedBy 一对一关联映射有两种: 一种是主键关联:限制两个数据表的主键使用相同的值 一种是外键关联:是一个外键和一个惟一关键字对应 一对一不产生新的字段而多对一会产生新的字段 多对一关联映射：在多的一端加入一个外键指向一的一端，它维护的关系是多指向一 一对多关联映射：在多的一端加入一个外键指向一的一端，它维护的关系是一指向多 也就是说一对多和多对一的映射策略是一样的，只是站的角度不同]]></description>
			<content:encoded><![CDATA[<p>hibernate中的关联映射主要有三种:一对一,一对多(多对一),多对多.它们都 可以分为单向和双向双种.<br />
凡是双向关联必设mappedBy<br />
一对一关联映射有两种:<br />
一种是主键关联:限制两个数据表的主键使用相同的值<br />
一种是外键关联:是一个外键和一个惟一关键字对应<br />
一对一不产生新的字段而多对一会产生新的字段<br />
多对一关联映射：在多的一端加入一个外键指向一的一端，它维护的关系是多指向一<br />
一对多关联映射：在多的一端加入一个外键指向一的一端，它维护的关系是一指向多<br />
也就是说一对多和多对一的映射策略是一样的，只是站的角度不同</p>
]]></content:encoded>
			<wfw:commentRss>http://www.licream.net/one-many.html/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>拙作四首</title>
		<link>http://www.licream.net/zzss.html/</link>
		<comments>http://www.licream.net/zzss.html/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 08:26:00 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Aaron专属]]></category>
		<category><![CDATA[绿水]]></category>
		<category><![CDATA[青山]]></category>

		<guid isPermaLink="false">http://www.licream.net/?p=387</guid>
		<description><![CDATA[&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;前些时候时间有点紧张,所以很少上. 这里献上四首诗.希望大家多多指点. 青山绿水歌 霜柳下，春风去，草亦无限绿。 不识故人伤心地，泪落涟涟凄。 媚阳暖过九寒季，回首堪望、何时归故里。 巍巍遥看西湖堤，圣贤曾作小儿郎。 踏遍江南诗千句，难解相思两人离。 今夜心有力，举杯高声语，青山绿水画如意，乾坤万年不眠休。 长空望 夜半清幽， 深寂寥人。 吾生至此， 实堪难忘。 雄心壮志， 如水东流。 吟诗作赋， 恍然若梦。 沧海桑田， 相隔两世。 泪落涟涟， 不复聚首。 杯酒利刃， 侠骨柔肠。 百年须臾， 几世漂泊。 云游四海， 五湖为家。 效法先人， 有心无力。 身似牢笼， 孤城一座。 长空相望， 虎狼之心。 提刀破虏， 挂印有期。 欲求 欲满满，水漂漂,十里浮云向天边。 离骚有恨终难忘，一世鬼神一世人。 鼓瑟秋风里，蝉鸣六月间。 傲梅冬日香，春意暖心田。 隔江犹见伊人舞，三生不忘共缠绵。 流沙赋 君不见 当空明月伤别离，时有盈满时有缺。 君不见 流沙河水千尺深，不见源头不见尾。 知音君子诚珍贵，愿与对饮三百杯。 功名利禄莫相期，金戈铁马忆从前。 人生如画随烟去，万千纠缠百年休。 檐下雀，钗头凤，类似同，天壤别。 如此类象何其多，千千万万道不尽。 太白神篇将进酒，失意还作三分乐。 拙作题名流沙赋，此中含义须分明。]]></description>
			<content:encoded><![CDATA[<h3>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<span style="color: #993300;">前些时候时间有点紧张,所以很少上.</span></h3>
<h3><span style="color: #993300;">这里献上四首诗.希望大家多多指点.</span></h3>
<p><strong><span style="color: #ff0000;">青山绿水歌</span></strong></p>
<p>霜柳下，春风去，草亦无限绿。</p>
<p>不识故人伤心地，泪落涟涟凄。</p>
<p>媚阳暖过九寒季，回首堪望、何时归故里。</p>
<p>巍巍遥看西湖堤，圣贤曾作小儿郎。</p>
<p>踏遍江南诗千句，难解相思两人离。</p>
<p>今夜心有力，举杯高声语，青山绿水画如意，乾坤万年不眠休。</p>
<p><span style="color: #ff0000;"><strong>长空望</strong></span><span id="more-387"></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">夜半清幽，</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">深寂寥人。</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">吾生至此，</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">实堪难忘。</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">雄心壮志，</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">如水东流。</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">吟诗作赋，</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">恍然若梦。</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">沧海桑田，</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">相隔两世。</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">泪落涟涟，</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">不复聚首。</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">杯酒利刃，</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">侠骨柔肠。</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">百年须臾，</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">几世漂泊。</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">云游四海，</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">五湖为家。</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">效法先人，</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">有心无力。</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">身似牢笼，</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">孤城一座。</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">长空相望，</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">虎狼之心。</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">提刀破虏，</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">挂印有期。</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;"><strong><span style="color: #ff0000;">欲求</span></strong></span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;"><span style="color: #000000;">欲满满，水漂漂,十里浮云向天边。</span></span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;"><span style="color: #000000;">离骚有恨终难忘，一世鬼神一世人。</span></span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;"><span style="color: #000000;">鼓瑟秋风里，蝉鸣六月间。</span></span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;"><span style="color: #000000;">傲梅冬日香，春意暖心田。</span></span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;"><span style="color: #000000;">隔江犹见伊人舞，三生不忘共缠绵。</span></span></span></p>
<address><strong><span style="font-style: normal;"><span style="color: #ff0000;">流沙赋</span></span></strong></address>
<address></address>
<p>君不见</p>
<p>当空明月伤别离，时有盈满时有缺。</p>
<p>君不见</p>
<p>流沙河水千尺深，不见源头不见尾。</p>
<p>知音君子诚珍贵，愿与对饮三百杯。</p>
<p>功名利禄莫相期，金戈铁马忆从前。</p>
<p>人生如画随烟去，万千纠缠百年休。</p>
<p>檐下雀，钗头凤，类似同，天壤别。</p>
<p>如此类象何其多，千千万万道不尽。</p>
<p>太白神篇将进酒，失意还作三分乐。</p>
<p>拙作题名流沙赋，此中含义须分明。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.licream.net/zzss.html/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>ID生成策略及Session用法</title>
		<link>http://www.licream.net/id-auto-session.html/</link>
		<comments>http://www.licream.net/id-auto-session.html/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 04:48:40 +0000</pubDate>
		<dc:creator>Licream</dc:creator>
				<category><![CDATA[Hibernate]]></category>

		<guid isPermaLink="false">http://www.licream.net/id%e7%94%9f%e6%88%90%e7%ad%96%e7%95%a5%e5%8f%8asession%e7%94%a8%e6%b3%95.html/</guid>
		<description><![CDATA[看了点ID生成的xml配置和annotation配置,重点放在annotation上面.为了经后需要吧.在实体类里利用@GeneratedValue来的strategy属性对主键设置生成策略的类型.常用的就IDENTITY(ms sql,mysql)和SEQUENCE(oracle).配置联合主键得需要用到,@EmbeddedId. @GeneratedValue(strategy=GenerationType.IDENTITY) Session需要SessionFactory来产生和管理.通常只需要一个sessionfactory. 打开session有二种方法: opensession:每次都是新的,需要手动关闭session. getcurrentsession:从上下文找,如果有,用旧的,没有建新的,带自动关闭sesison. 对于自定义的hibernate配置xml可用configure(&#8220;hibernate.cfg.xml&#8221;)指定. get:直接从数据库加载,不会延迟 load:返回的是代理对偈.等真正用到对像的内容时才发出sql语句. 无论是load还是get都会首先查找缓存(一级缓存),如果没有,才会去数据库查找.调用clear()方法可以强制清除session缓存. 调用flush()方法可以强制进行从内存到数年据库的同步,merge()用来合并数据. 实操中遇到Field &#8216;id&#8217; doesn&#8217;t have a default value错误:在对ID设置好策略后ID也不自动递增.网上基本都是说修改my.ini.我没去试.后来我把表删表..就正常了- -!]]></description>
			<content:encoded><![CDATA[<p>看了点ID生成的xml配置和annotation配置,重点放在annotation上面.为了经后需要吧.在实体类里利用@GeneratedValue来的strategy属性对主键设置生成策略的类型.常用的就IDENTITY(ms sql,mysql)和SEQUENCE(oracle).配置联合主键得需要用到,@EmbeddedId.</p>
<p>@GeneratedValue(strategy=GenerationType.IDENTITY)</p>
<p>Session需要SessionFactory来产生和管理.通常只需要一个sessionfactory.</p>
<p>打开session有二种方法:</p>
<p>opensession:每次都是新的,需要手动关闭session.</p>
<p><span id="more-386"></span></p>
<p>getcurrentsession:从上下文找,如果有,用旧的,没有建新的,带自动关闭sesison.</p>
<p>对于自定义的hibernate配置xml可用configure(&#8220;hibernate.cfg.xml&#8221;)指定.</p>
<p>get:直接从数据库加载,不会延迟</p>
<p>load:返回的是代理对偈.等真正用到对像的内容时才发出sql语句.</p>
<p>无论是load还是get都会首先查找缓存(一级缓存),如果没有,才会去数据库查找.调用clear()方法可以强制清除session缓存.</p>
<p>调用flush()方法可以强制进行从内存到数年据库的同步,merge()用来合并数据.</p>
<p>实操中遇到Field &#8216;id&#8217; doesn&#8217;t have a default value错误:在对ID设置好策略后ID也不自动递增.网上基本都是说修改my.ini.我没去试.后来我把表删表..就正常了- -!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.licream.net/id-auto-session.html/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>log4j及junit使用</title>
		<link>http://www.licream.net/log4j-junit.html/</link>
		<comments>http://www.licream.net/log4j-junit.html/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 12:20:38 +0000</pubDate>
		<dc:creator>Licream</dc:creator>
				<category><![CDATA[Hibernate]]></category>

		<guid isPermaLink="false">http://www.licream.net/log4j%e5%8f%8ajunit%e4%bd%bf%e7%94%a8.html/</guid>
		<description><![CDATA[在昨天原基础上加了log4j和junit功能,使用log4j之前须导入JAR包,再把properties文件复制过来,src目录下. 配置相应需求的信息,既可使用,不导出文件log格式搞不定.junit同样加入须求的JAR包.操作方法:建立类的相同包名.在test包里新建一个junit类.选择需要测试的类.生成一个空类.把执行代码加入.在类里一定要写上@test注解.老师说,每次运行都要sessionFactory..麻烦.所以又可用注解来解决这难题 @beforeclass:用来初始化方法 @afterclass:用来注乐销方法, 用他们一定要加上static. 如: private static SessionFactory sf=null; @BeforeClass public static void beforeclass(){ try { sf=new AnnotationConfiguration().configure().buildSessionFactory(); } catch (HibernateException e) { e.printStackTrace(); } } @AfterClass public static void afterclass(){ sf.close(); } 测试方法必须带public void来创建,不可带任何参数. 出现隐藏错误需添加try..catch或main来单独执行方来找出问题. [Downlink href="http://211.101.133.202:8081/UploadFiles/200981715104232.doc"]Junit文档[/Downlink]]]></description>
			<content:encoded><![CDATA[<p>在昨天原基础上加了log4j和junit功能,使用log4j之前须导入JAR包,再把properties文件复制过来,src目录下.</p>
<p>配置相应需求的信息,既可使用,不导出文件log格式搞不定.junit同样加入须求的JAR包.操作方法:建立类的相同包名.在test包里新建一个junit类.选择需要测试的类.生成一个空类.把执行代码加入.在类里一定要写上@test注解.老师说,每次运行都要sessionFactory..麻烦.所以又可用注解来解决这难题</p>
<p><span id="more-380"></span></p>
<p>@beforeclass:用来初始化方法</p>
<p>@afterclass:用来注乐销方法,</p>
<p>用他们一定要加上static.</p>
<p>如:</p>
<pre class="brush: java;">private static SessionFactory sf=null;
@BeforeClass
public static void beforeclass(){
              try {
                        sf=new AnnotationConfiguration().configure().buildSessionFactory();
                   } catch (HibernateException e) {
                       e.printStackTrace();
                    }   }
 @AfterClass
  public static void afterclass(){
           sf.close();
 } </pre>
<p>测试方法必须带public void来创建,不可带任何参数.</p>
<p>出现隐藏错误需添加try..catch或main来单独执行方来找出问题.</p>
<p> [Downlink href="http://211.101.133.202:8081/UploadFiles/200981715104232.doc"]Junit文档[/Downlink]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.licream.net/log4j-junit.html/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>hibernate annotation遇到的问题总结</title>
		<link>http://www.licream.net/hibernate-annotation.html/</link>
		<comments>http://www.licream.net/hibernate-annotation.html/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 10:49:30 +0000</pubDate>
		<dc:creator>Licream</dc:creator>
				<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[annotation]]></category>

		<guid isPermaLink="false">http://www.licream.net/hibernate-annotation%e9%81%87%e5%88%b0%e7%9a%84%e9%97%ae%e9%a2%98%e6%80%bb%e7%bb%93/</guid>
		<description><![CDATA[写的第一个程序hello world…出现了一大堆问题.最终利用百度大神全部搜了遍,已经搞定!我将把这些问题总结下,方便以后使用. 1.sessionFactory = new Configuration().configure() .buildSessionFactory(); 解决方法:由于是用annotation来实现功能,配置方法需改成sessionFactory = new AnnotationConfiguration().configure() .buildSessionFactory();// AnnotationConfiguration(); 2.Exception in thread &#8220;main&#8221; java.lang.NoClassDefFoundError: javax/persistence/Cacheable 解决方法:添加hibernate-jpa-2.0-api-1.0.0.Final.jar.JAR包. 3.java.lang.NoClassDefFoundError:(annotation注解class出错)在肯定无错的情况下还是错,郁闷. 解决方法:还是添加JAR包,我少了hibernate-commons-annotations.jar. 4. &#60;!-- Disable the second-level cache --&#62; &#60;!-- &#60;property name=&#34;cache.provider_class&#34;&#62; org.hibernate.cache.NoCacheProvider &#60;/property&#62;--&#62; 这个配置具体我也不是很清楚.感觉是缓存相关的吧,不关闭他也是没用的.关掉后就正常了. 以上问题也不是什么问题.都是自已粗心,没有加完必要的包 最后把必要的JAR包图发来:)]]></description>
			<content:encoded><![CDATA[<p>写的第一个程序hello world…出现了一大堆问题.最终利用百度大神全部搜了遍,已经搞定!我将把这些问题总结下,方便以后使用.</p>
<p>1.sessionFactory = new Configuration().configure() .buildSessionFactory();</p>
<p>解决方法:由于是用annotation来实现功能,配置方法需改成sessionFactory = new AnnotationConfiguration().configure() .buildSessionFactory();// <strong>AnnotationConfiguration</strong>();</p>
<p>2.Exception in thread &#8220;main&#8221; java.lang.NoClassDefFoundError: <em>javax</em>/<em>persistence</em>/<em>Cacheable</em></p>
<p>解决方法:添加hibernate-jpa-2.0-api-1.0.0.Final.jar.JAR包.</p>
<p>3.java.lang.NoClassDefFoundError:(annotation注解class出错)在肯定无错的情况下还是错,郁闷.</p>
<p>解决方法:还是添加JAR包,我少了hibernate-commons-annotations.jar.</p>
<p><span id="more-378"></span></p>
<p>4.
<pre class="brush: xml;">&lt;!-- Disable the second-level cache  --&gt;
&lt;!--
&lt;property name=&quot;cache.provider_class&quot;&gt; org.hibernate.cache.NoCacheProvider
&lt;/property&gt;--&gt;</pre>
<p>这个配置具体我也不是很清楚.感觉是缓存相关的吧,不关闭他也是没用的.关掉后就正常了.</p>
<p>以上问题也不是什么问题.都是自已粗心,没有加完必要的包</p>
<p>最后把必要的JAR包图发来:)</p>
<p><a href="http://www.licream.net/wp-content/uploads/2010/04/hibernate.jpg"><img style="display: inline; border: 0px;" title="hibernate" src="http://www.licream.net/wp-content/uploads/2010/04/hibernate_thumb.jpg" border="0" alt="hibernate" width="222" height="323" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.licream.net/hibernate-annotation.html/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
