---
title: "公开SNS社区即时找朋友链的源代码和部署方案（续六）"
author: "markhe"
date: "2012-04-23T14:48:45Z"
tags: []
categories: ["数据库"]
slug: "sns"
draft: false
lastmod: "2012-04-23T14:48:45Z"
id: 1495428
url: "https://markhe.iteye.com/blog/1495428"
---

Versant数据库的对象查询
	Versant数据库可以支持SQL查询和NOSQL查询两种模式，以下为SQL查询的例子：

		TransSession session = DistributedDatabaseManager.getInstance()
				.createNewSession();

		VQLQuery q = new VQLQuery(
				session,

				DistributedDatabaseManager.getInstance().HPC_DEMO_NETWORK_NAME,
				"select selfoid from com.versant.domain.Person where firstName='AAF1' and lastName='AAL1'");
				//"select * from com.versant.domain.Person");

		System.out.println("About to execute query, and load root object.");
		VEnumeration results = q.execute();

		// 创建已经走过的朋友路径，避免回环
		System.out
				.println("--------------------------------------------------------------------------");