<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>评论：Berkeley DB Java版直接持久层基础</title>
	<atom:link href="http://www.bdbchina.com/2009/01/berkeley-db-je-dpl-basics/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bdbchina.com/2009/01/berkeley-db-je-dpl-basics/</link>
	<description>Oracle Berkeley DB 中国研发团队的博客</description>
	<lastBuildDate>Mon, 19 Jul 2010 03:43:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>来自：chaohuang</title>
		<link>http://www.bdbchina.com/2009/01/berkeley-db-je-dpl-basics/comment-page-1/#comment-374</link>
		<dc:creator>chaohuang</dc:creator>
		<pubDate>Tue, 13 Oct 2009 03:32:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdbchina.com/?p=25#comment-374</guid>
		<description>&lt;a href=&quot;#comment-370&quot; rel=&quot;nofollow&quot;&gt;@徐明松&lt;/a&gt; 
请仔细读一下JE的Get Started Guide 和实例代码，我相信你可以自己解决的。

或者，你干脆不要事物：env.setTxnal(false), db.setTxnal(false); - 具体请查Javadoc。</description>
		<content:encoded><![CDATA[<p><a href="#comment-370" rel="nofollow">@徐明松</a><br />
请仔细读一下JE的Get Started Guide 和实例代码，我相信你可以自己解决的。</p>
<p>或者，你干脆不要事物：env.setTxnal(false), db.setTxnal(false); &#8211; 具体请查Javadoc。</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：徐明松</title>
		<link>http://www.bdbchina.com/2009/01/berkeley-db-je-dpl-basics/comment-page-1/#comment-370</link>
		<dc:creator>徐明松</dc:creator>
		<pubDate>Tue, 13 Oct 2009 01:08:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdbchina.com/?p=25#comment-370</guid>
		<description>我修改了还是报:
Transaction not specified for a transactional database错误</description>
		<content:encoded><![CDATA[<p>我修改了还是报:<br />
Transaction not specified for a transactional database错误</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：chaohuang</title>
		<link>http://www.bdbchina.com/2009/01/berkeley-db-je-dpl-basics/comment-page-1/#comment-362</link>
		<dc:creator>chaohuang</dc:creator>
		<pubDate>Mon, 12 Oct 2009 04:53:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdbchina.com/?p=25#comment-362</guid>
		<description>&lt;a href=&quot;#comment-358&quot; rel=&quot;nofollow&quot;&gt;@徐明松&lt;/a&gt;
原因：你open database的时候，指定了事物 - transaction；但是使用EntityCursor没有指定事物设置。
解决办法：使用paccessor.personByPId.entities(Transaction txn, CursorConfig config)方法来替换原来的。</description>
		<content:encoded><![CDATA[<p><a href="#comment-358" rel="nofollow">@徐明松</a><br />
原因：你open database的时候，指定了事物 &#8211; transaction；但是使用EntityCursor没有指定事物设置。<br />
解决办法：使用paccessor.personByPId.entities(Transaction txn, CursorConfig config)方法来替换原来的。</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：徐明松</title>
		<link>http://www.bdbchina.com/2009/01/berkeley-db-je-dpl-basics/comment-page-1/#comment-358</link>
		<dc:creator>徐明松</dc:creator>
		<pubDate>Sat, 10 Oct 2009 09:05:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdbchina.com/?p=25#comment-358</guid>
		<description>我用EntityCursor来修改和删除数据的主要代码如下:

EntityCursor ec=paccessor.personByPId.entities();

ec=paccessor.personByPId.entities();
for(Person p:ec){
if(p.pid==4){
p.pname=p.pname.toUpperCase();
ec.update(p);
ec.delete();
}
}

程序给我报了:Transaction not specified for a transactional database
这是什么原因??????
非常谢谢你的回答!!!!</description>
		<content:encoded><![CDATA[<p>我用EntityCursor来修改和删除数据的主要代码如下:</p>
<p>EntityCursor ec=paccessor.personByPId.entities();</p>
<p>ec=paccessor.personByPId.entities();<br />
for(Person p:ec){<br />
if(p.pid==4){<br />
p.pname=p.pname.toUpperCase();<br />
ec.update(p);<br />
ec.delete();<br />
}<br />
}</p>
<p>程序给我报了:Transaction not specified for a transactional database<br />
这是什么原因??????<br />
非常谢谢你的回答!!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：chaohuang</title>
		<link>http://www.bdbchina.com/2009/01/berkeley-db-je-dpl-basics/comment-page-1/#comment-352</link>
		<dc:creator>chaohuang</dc:creator>
		<pubDate>Fri, 09 Oct 2009 10:20:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdbchina.com/?p=25#comment-352</guid>
		<description>&lt;a href=&quot;#comment-351&quot; rel=&quot;nofollow&quot;&gt;@徐明松&lt;/a&gt; 
你所谓的级联是什么意思？是指外键的级联删除吗？BDB和BDB-JE都支持外键级联删除。</description>
		<content:encoded><![CDATA[<p><a href="#comment-351" rel="nofollow">@徐明松</a><br />
你所谓的级联是什么意思？是指外键的级联删除吗？BDB和BDB-JE都支持外键级联删除。</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：徐明松</title>
		<link>http://www.bdbchina.com/2009/01/berkeley-db-je-dpl-basics/comment-page-1/#comment-351</link>
		<dc:creator>徐明松</dc:creator>
		<pubDate>Fri, 09 Oct 2009 10:01:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdbchina.com/?p=25#comment-351</guid>
		<description>bdb存储数据时可以用级联不??????</description>
		<content:encoded><![CDATA[<p>bdb存储数据时可以用级联不??????</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：chaohuang</title>
		<link>http://www.bdbchina.com/2009/01/berkeley-db-je-dpl-basics/comment-page-1/#comment-348</link>
		<dc:creator>chaohuang</dc:creator>
		<pubDate>Fri, 09 Oct 2009 09:24:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdbchina.com/?p=25#comment-348</guid>
		<description>&lt;a href=&quot;#comment-347&quot; rel=&quot;nofollow&quot;&gt;@徐明松&lt;/a&gt; 
从代码上我看不出太大问题。我的建议是：你尽量使用Cursor（如EntityCursor等）来做读取、插入、修改和删除操作。如果你的程序始终处于运行状态，你可以做一个thread dump并发来看看 - /bin/jstack pid.

另可参考http://www.bdbchina.com/2009/02/%E5%9C%A8berkeley-db-java%E7%89%88%E4%B8%AD%E5%AE%9E%E7%8E%B0sql%E6%9F%A5%E8%AF%A2/。其中的例子程序在&lt;je_release&gt;/example/persist/sqlapp下。</description>
		<content:encoded><![CDATA[<p><a href="#comment-347" rel="nofollow">@徐明松</a><br />
从代码上我看不出太大问题。我的建议是：你尽量使用Cursor（如EntityCursor等）来做读取、插入、修改和删除操作。如果你的程序始终处于运行状态，你可以做一个thread dump并发来看看 &#8211; /bin/jstack pid.</p>
<p>另可参考http://www.bdbchina.com/2009/02/%E5%9C%A8berkeley-db-java%E7%89%88%E4%B8%AD%E5%AE%9E%E7%8E%B0sql%E6%9F%A5%E8%AF%A2/。其中的例子程序在<je_release>/example/persist/sqlapp下。</je_release></p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：徐明松</title>
		<link>http://www.bdbchina.com/2009/01/berkeley-db-je-dpl-basics/comment-page-1/#comment-347</link>
		<dc:creator>徐明松</dc:creator>
		<pubDate>Fri, 09 Oct 2009 08:39:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdbchina.com/?p=25#comment-347</guid>
		<description>谢谢你的回答.
下面是我在写one-one时出现的问题:
代码如下:
人类:
@Entity
public class Person {
	@PrimaryKey
	 int pid;
	@SecondaryKey(relate=Relationship.MANY_TO_ONE)
	 String pname;
@SecondaryKey(relate=Relationship.ONE_TO_ONE,relatedEntity=Idcard.class,onRelatedEntityDelete=DeleteAction.CASCADE)
	 int id;
	public Person(){}
	public Person(int pid,String name,int id){
		this.pid=pid;
		this.pname=name;
		this.id=id;
	}
}
身份证类:
@Entity
public class Idcard {
	@PrimaryKey
	 int id;
	@SecondaryKey(relate=Relationship.ONE_TO_ONE)
	 String idcard;
	public Idcard(){}
	public Idcard(int id,String idcard){
		this.id=id;
		this.idcard=idcard;
	}
}
上面是我的代码，在插入数据之后我想对人的姓名进行修改时，虽然不会报什么错但是它始终处于运行状态，下次读取数据的时候就读不到了。
修改的代码如下:
Person person=paccessor.personByPId.get(4);
person.pname=&quot;berkeley&quot;;
paccessor.personByPId.putNoReturn(person);
//这里得不到数据了
System.out.println(paccessor.personByPId.get(4).pname);

还有就是：
在删除信息时，也会出现上面的问题,删除代码如下:
paccessor.personByPId.delete(2);

请你帮我解释一下，非常谢谢!!!</description>
		<content:encoded><![CDATA[<p>谢谢你的回答.<br />
下面是我在写one-one时出现的问题:<br />
代码如下:<br />
人类:<br />
@Entity<br />
public class Person {<br />
	@PrimaryKey<br />
	 int pid;<br />
	@SecondaryKey(relate=Relationship.MANY_TO_ONE)<br />
	 String pname;<br />
@SecondaryKey(relate=Relationship.ONE_TO_ONE,relatedEntity=Idcard.class,onRelatedEntityDelete=DeleteAction.CASCADE)<br />
	 int id;<br />
	public Person(){}<br />
	public Person(int pid,String name,int id){<br />
		this.pid=pid;<br />
		this.pname=name;<br />
		this.id=id;<br />
	}<br />
}<br />
身份证类:<br />
@Entity<br />
public class Idcard {<br />
	@PrimaryKey<br />
	 int id;<br />
	@SecondaryKey(relate=Relationship.ONE_TO_ONE)<br />
	 String idcard;<br />
	public Idcard(){}<br />
	public Idcard(int id,String idcard){<br />
		this.id=id;<br />
		this.idcard=idcard;<br />
	}<br />
}<br />
上面是我的代码，在插入数据之后我想对人的姓名进行修改时，虽然不会报什么错但是它始终处于运行状态，下次读取数据的时候就读不到了。<br />
修改的代码如下:<br />
Person person=paccessor.personByPId.get(4);<br />
person.pname=&#8221;berkeley&#8221;;<br />
paccessor.personByPId.putNoReturn(person);<br />
//这里得不到数据了<br />
System.out.println(paccessor.personByPId.get(4).pname);</p>
<p>还有就是：<br />
在删除信息时，也会出现上面的问题,删除代码如下:<br />
paccessor.personByPId.delete(2);</p>
<p>请你帮我解释一下，非常谢谢!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：taozhang</title>
		<link>http://www.bdbchina.com/2009/01/berkeley-db-je-dpl-basics/comment-page-1/#comment-345</link>
		<dc:creator>taozhang</dc:creator>
		<pubDate>Fri, 09 Oct 2009 03:40:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdbchina.com/?p=25#comment-345</guid>
		<description>@Entity标注的是一条记录，而@Persistnt标注的是一个字段，具体请参看以下两个链接：
&lt;a href=&quot;http://www.oracle.com/technology/documentation/berkeley-db/je/java/com/sleepycat/persist/model/Entity.html&quot; rel=&quot;nofollow&quot;&gt;Entity&lt;/a&gt;，
&lt;a href=&quot;http://www.oracle.com/technology/documentation/berkeley-db/je/java/com/sleepycat/persist/model/Persistent.html&quot; rel=&quot;nofollow&quot;&gt;Persistent&lt;/a&gt;。</description>
		<content:encoded><![CDATA[<p>@Entity标注的是一条记录，而@Persistnt标注的是一个字段，具体请参看以下两个链接：<br />
<a href="http://www.oracle.com/technology/documentation/berkeley-db/je/java/com/sleepycat/persist/model/Entity.html" rel="nofollow">Entity</a>，<br />
<a href="http://www.oracle.com/technology/documentation/berkeley-db/je/java/com/sleepycat/persist/model/Persistent.html" rel="nofollow">Persistent</a>。</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：徐明松</title>
		<link>http://www.bdbchina.com/2009/01/berkeley-db-je-dpl-basics/comment-page-1/#comment-342</link>
		<dc:creator>徐明松</dc:creator>
		<pubDate>Fri, 09 Oct 2009 01:59:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdbchina.com/?p=25#comment-342</guid>
		<description>实现关系映射的时候中@persistent和@entity它们两的区别是什么？？</description>
		<content:encoded><![CDATA[<p>实现关系映射的时候中@persistent和@entity它们两的区别是什么？？</p>
]]></content:encoded>
	</item>
</channel>
</rss>
Դ