hibernate

ORM tools for Java

Any ORM tools available for java other than Hibernate, with high scalability. ...

Can you explain inheritance in Nhibernate to me?

Im having a hard time understanding how inheritance works with NHibernate, with regards to mapping with .hbm.xml files. ...

Inheritance in Hibernate Annotations??

How can I use "inheritance" in Annotations? What are the advantages of using inheritance in Annotations? ...

Implementing Collections based (DDD) Repository with Hibernate

I'm trying to see if it's possible to implement a repository as a java.util.Collection (most likely a Map). Something along these lines: @Repository public abstract class HibernateRepository<K extends Serializable, V> extends AbstractMap<K, V> { @Autowired private SessionFactory sessionFactory; private Class<K> keyCla...

Determining ManyToMany vs OneToMany using ClassMetadata

...

Hibernate c3p0 connection pool not timing out idle connections

We have a java server connecting to a MySQL 5 database usingHibernate as our persistence layer which is using c3p0 for DB connection pooling. I've tried following the c3p0 and hibernate documentation: Hibernate - HowTo Configure c3p0 connection pool C3P0 Hibernate properties C3P0.properties configuration We're getting an error on ...

Can I have a collection of IUserType instances?

Is it possible to have a collection of entities that are mapped via an IUserType? For example: class Foo { public int Id { get; set; } public ISet<Special> Items { get; set; } } class Special { public Special(string columnValue) { _val = columnValue; } public override string ToString() { re...

Table not created by Hibernate

I annotated a bunch of POJO's so JPA can use them to create tables in Hibernate. It appears that all of the tables are created except one very central table called "Revision". The Revision class has an @Entity(name="RevisionT") annotation so it will be renamed to RevisionT so there is not a conflict with any reserved words in MySQL (th...

What is the difference between DELETE_ORPHAN and DELETE ?

Here is source code: @OneToOne(fetch = FetchType.LAZY) @Cascade({SAVE_UPDATE, EVICT, DELETE}) @JoinColumn(name = "A_ID", nullable = true) private A a; @OneToMany @Cascade({SAVE_UPDATE, EVICT, DELETE, DELETE_ORPHAN}) @JoinColumn(name = "B_ID") private List<B> bList; What is the difference between DELETE_ORPHAN and DELETE ? ...

attempt to create saveOrUpdate event with null entity

Hello all, I've run into a problem I can't figure out and Google search does not return much (I should of thought about posting my question here first ;-). So I've got a GWT app, that makes a rpc call to a server to save/create a new entity. However, the Spring-Hibernate back-end throws an exception with the following error message: ...

JPA Instrumentation

Is it somehow possible to see the DDL produced when opening a EntityManagerFactory in JPA? I seem to be having some problems but no errors are produced. I don't see any sort of log file and no output is written to StdOut or StdErr. I have a log4j.properties in src/main/resources: log4j.appender.stdout=org.apache.log4j.ConsoleAppende...

commandline equivalent to reverse engineering in Hibernate tools?

Is there a relatively simple way to reverse engineer a database from the command line and generate Hibernate artifacts based on the database? the only info I've been able to find on doing this requires jumping through lots of hoops with Hibernate tools that weren't designed for command line use, and ant build files. ...

Cannot create schema from Hibernate

I'm trying to propagate the schema from the Hibernate configuration to the RDBMS. The code runs without any error message but the database doesn't get updated. Any hints ? Thank you ! Update That is hibernate-core only with a HSQL database. Update 2 Yes, i should use SchemaExport (i'm away from hibernate a while ),but it don't flush ...

How do I get more debug messages from Hibernate?

I haven't been able to get any more console output (to help with debugging) from Hibernate despite setting a few properties in the hibernate.cfg.xml file. For example, adding the line <property name="show_sql">true</property> did not, in fact, show SQL statements in the console. I've also tried playing around with the contents of the lo...

@OneToOne getting returned as ManyToOneType

I have the following POJO: public class SampleBean1 { @Id @GeneratedValue(generator = "system-uuid") @GenericGenerator(name = "system-uuid", strategy = "uuid") protected String id; @OneToOne(cascade=CascadeType.ALL) @JoinColumn(name="OneToOneID") protected SampleBean1 oneToOne; @OneToMany(cascade=Casca...

Hibernate not throwing exception when openSession is called and the connection to DB cannot be established

When I configure hibernate to connect to a DB and for some reason the connection fails, I noticed that it doesnt throw any exception neither when building the factory (which is acceptable) nor when I call sessionFactory.openSession() (which is less acceptable). What is more annoying is that session.isConnected() returns true after I call...

Auto Generating Hibernate Entities

Hi, I have a pretty complex database schema and would like to know if there are any tools which I can use to auto-generate the entities if I am using Hibernate as my persistence mechanism. Thanks. ...

How to repeat a particular execution multiple times

The following snippet generates create / drop sql for a particular database, whenever there is a modification to JPA entity classes. How do I perform something equivalent of a 'for' operation where-in the following code can be used to generate sql for all supported databases (e.g. H2, MySQL, Postgres) Currently I have to modify db.grou...

cast(val as char) in hibernate config named query

Hi I am facing data truncation issue with hibernate for DB2 Char datatype. I am getting only the first character for DB2 char datatype using hibernate. I looked through the net and got two threads with similar issues. These two threads mentions either to modify the dialect or cast as char in sql query. below are the two similar threa...

Can a single EntityManager (Hibernate) participate in multiple concurrent transactions?

Hi! Is there a way one EntityManager can participate smoothely in multiple concurrent transactions? Well, not that concurrent. Something like: Start tx 1 Do stuff in tx 1 Start tx 2 Do stuff in tx 2 Commit tx 2 Join tx 1 back Do stuff in tx 1 Commit tx 1 with steps followed one by one not overlapping. ...