Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
<!-- on persistence.xml file -->
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="pu" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/DefaultDS</jta-data-source>
<properties>
@Entity
public class A {
@Id @GeneratedValue(strategy=SEQUENCE)
public Integer getId() { return id; }
public void setId(Integer id) { this.id = id; }
private Integer id;
public String getName() { return name; }
private void setName(String name) { this.name = name; }
private String name;
@emmanuelbernard
emmanuelbernard / build.sh
Created January 20, 2011 09:28
build your project in the background while you can work on the next bug
#!/bin/bash
# Clones your existing repo and run the maven tests off this clone
# Tests are run on the the current branch at the time of cloning
#
# Note that you can work on the next bug while this is going on as
# tests are run off a cloned repo.
#
# $ build.sh
# runs 'maven clean install'
#
manu@emmanuel-mbp-15 core (master) $ gradle test
:buildSrc:compileJava UP-TO-DATE
:buildSrc:compileGroovy UP-TO-DATE
:buildSrc:processResources UP-TO-DATE
:buildSrc:classes UP-TO-DATE
:buildSrc:jar UP-TO-DATE
:buildSrc:assemble UP-TO-DATE
:buildSrc:compileTestJava UP-TO-DATE
:buildSrc:compileTestGroovy UP-TO-DATE
:buildSrc:processTestResources UP-TO-DATE
doHibernateStuff() {
hSearchQuery = new HSQuery();
hSearchQuery.getTimeoutManager().start();
hSearchQuery. ...
...
hSearchQuery.getTimeoutManager().stop();
}
package com.jamesward;
import java.util.List;
import org.springframework.flex.remoting.RemotingDestination;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
Tests in error:
testExternalJar(org.hibernate.ejb.test.packaging.PackagedEntityManagerTest)
testORMFileOnMainAndExplicitJars(org.hibernate.ejb.test.packaging.PackagedEntityManagerTest)
-------------------------------------------------------------------------------
Test set: org.hibernate.ejb.test.packaging.PackagedEntityManagerTest
-------------------------------------------------------------------------------
Tests run: 13, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 3.253 sec <<< FAILURE!
testExternalJar(org.hibernate.ejb.test.packaging.PackagedEntityManagerTest) Time elapsed: 0.327 sec <<< ERROR!
java.lang.IllegalArgumentException: Unknown entity: org.hibernate.ejb.test.pack.externaljar.Scooter
FacetRequest rangeRequest = queryBuilder( Fruit.class ).facet()
.name( priceRange )
.onField( indexFieldName )
.range().below(1.0).excludeLimit()
.from( 1.0 ).to( 1.50 ).excludeLimit()
.from( 1.50 ).to( 3.00 ).excludeLimit()
.above(3)
.createFacet();
@emmanuelbernard
emmanuelbernard / FacetedSearchService.java
Created March 14, 2011 13:57
Version with existing API
/**
* @author Emmanuel Bernard <emmanuel@hibernate.org>
*/
public class SearchService {
@Inject
FullTextEntityManager em;
private org.hibernate.search.FullTextQuery ftQuery;
private Map<FacetResult, OrFacetFilter> filtersByFacetResult = new HashMap<FacetResult, OrFacetFilter>();