.createNativeQuery("select p.id from projects p where p.kee=:resourceKey and p.qualifier<>:lib and p.enabled=:enabled");
query.setParameter("resourceKey", projectTree.getRootProject().getKey());
query.setParameter("lib", Qualifiers.LIBRARY);
query.setParameter("enabled", Boolean.TRUE);
Snapshot snapshot = null;
Number projectId = session.getSingleResult(query, null);
if (projectId != null) {
snapshot = new Snapshot();
snapshot.setResourceId(projectId.intValue());
snapshot.setCreatedAt(projectTree.getRootProject().getAnalysisDate());
snapshot.setBuildDate(new Date());
snapshot.setVersion(projectTree.getRootProject().getAnalysisVersion());
}
return snapshot;
}