Hi everybody! 

For demo purposes, there's a class Book that goes as follows: 

@Entity
@Table(name="book")
public class Book implements Serializable {
@Id
private String id;
private String title;
private String description;
private Float unitcost;
private String isbn;
private Integer nbofpages;

//Default ctor... getters & setters... toString...
}

I created a basic rule that checks if Book's title contains "Java" it's left in the session, otherwise it's retracted: 

dialect "mvel"
import com.arcady.*;

rule "not a java book"
when
b:Book(title.contains("Java")==false)
then
System.out.println("Yet another boring book... Retracting: " + b.toString());
retract(b);
end

So far, so good. Problem now is when trying to persist all the Drools + Book's instances that still remained in the session into MySQL database (I usedhttp://packtlib.packtpub.com/library/9781849511964/ch02lvl1sec17 as reference). 

After inserting 4 books as listed below into the session and firing all rules: 
Book javaBook1 = new Book("Java EE 7");
Book javaBook2 = new Book("Java Persistence API 2.1");
Book javaBook3 = new Book("Java SE 8");
Book csharpBook1 = new Book("C# 5.0");

I get in the output: 
Hibernate: insert into SessionInfo (lastModificationDate, rulesByteArray, startDate, OPTLOCK) values (?, ?, ?, ?)
Hibernate: update SessionInfo set lastModificationDate=?, rulesByteArray=?, startDate=?, OPTLOCK=? where id=? and OPTLOCK=?
Hibernate: update SessionInfo set lastModificationDate=?, rulesByteArray=?, startDate=?, OPTLOCK=? where id=? and OPTLOCK=?
Hibernate: update SessionInfo set lastModificationDate=?, rulesByteArray=?, startDate=?, OPTLOCK=? where id=? and OPTLOCK=?
Yet another boring book... Retracting: Book{id=304e76fd-3d9a-479b-b22d-a774d721df65, title='C# 5.0', description='Blabla', unitcost=0.0, isbn='ABC123', nbofpages=12345}
Hibernate: update SessionInfo set lastModificationDate=?, rulesByteArray=?, startDate=?, OPTLOCK=? where id=? and OPTLOCK=?

Thus the session was persisted 4 times, and indeed that's what also shows in the database in the sessioninfo table. 

Problem is Book's table is created with all the correct columns automatically but remains empty... 

What do you think causes this? 

Thanks a lot!

--
Regards,
Arcady Trembovler