hibernate

How to check if an JPA/hibernate database is up with second-level caching

I have a JSP/Spring application using Hibernate/JPA connected to a database. I have an external program that check if the web server is up every 5 minutes. The program call a specific URL to check if the web server is still running. The server returns "SUCCESS". Obviously if the server is now, nothing is returned. The request timesout a...

Java/Hibernate: how to write DAO code for complex SQLs

Hi all, My current workplace uses the standard Spring/Hibernate/JSP mix to serve content to its Flex client via XML. There are many ways in which the data is accessed, but the most prevalent one is via direct SQL calls to the database and a manual conversion to XML. The trouble is that as the application grew bigger, the SQLs became mu...

Spring + Hibernate : a different object with the same identifier value was already associated with the session

Greeting , In my non-web application(using Spring,Hibernate), I parse a CSV file and populate db using following method. handleRow() is called everytime a new raw is read from CSV file. My domain model: 'Family' has many 'SubFamiliy' 'SubFamily' has many 'Locus' a 'Locus' belongs to a 'Species' Family<>SubFamily<>Locus...

Lazy-loading with Spring HibernateDaoSupport ?

Greetings I am developing a non-webapplication using Spring+Hibernate. My question is how the HibernateDaoSupport handles lazy-loading , because after a call do DAO , the Session is closed. Take a look at following psuedo-code: DAO is like: CommonDao extends HibernateDaoSupport{ Family getFamilyById(String id); SubFamily getSubFamil...

Differerence between hibernate types: boolean, yes_no, true_false

When to use each? To what do they map in the database? ...

Is there any c++ persistent solution like java hibernate ?

Hello all correct me if i wrong but i don't know any solution in c++ that is similar to java persistent hibernate is there ? ...

Hibernate: How can I join 2 classes in one table?

So, I'm pretty new to Hibernate and I have a problem. I have an abstract class (the super-class, class Super), and 5 subclasses which should use the proprieties from the class Super and add a new propriety (a new column) So how can I do this? Should I extend the class Super from java, or it's enough to join the classes using a JPA anno...

spring mvc: select tag

i have 2 table: message(id, name, content, channel_number) // channel_number is foreign key channel(number, name) // number is primary key i use hibernate to map 2 table java class public class Message { private Integer id; private String name; private String content; private Channel channel; } public class Channel { priv...

how does the new keyword in hql work?

I found this example in jboss's documentation. select new Family(mother, mate, offspr) from DomesticCat as mother join mother.mate as mate left join mother.kittens as offspr Where does the Family class come from. Do I need to import somewhere, or to use its fully qualified class name? ...

Hibernate: Automatic Versioning Nullable Column

Hi I have a table which contains huge data. I want to add hibernate automatic versioning to this table. But adding a not-null column to this table for versioning is very expensive due to huge data. Is there a workaround so hibernate can work with nullable column? Currently hibernate gives NPE because it tries to increment a null value. ...

Problem with Hibernate find method

UPDATE: EXAMPLE TO CLARIFY I'm going to put an example of what's happening just to clarify the situation in my Spring + Hibernate application. Imagine I have this two entities (suppose getters and setters exists too) @Entity public class Class1(){ private Integer id; @OneToOne private Class2 object2; } @Entity public class Clas...

Hibernate query not returning full object

I have a list of items. Each item has set of categories. I want to grab all the items of a specific category. This part is simple. The part I am having problems with is getting my query to return the item with all of its categories, not just the one I am filtering on. session.createCriteria(Item.class) .createAlias("categories"...

Is it possible to lock lazy filed in hibernate?

I have Category class containing list of products. Like this: public class Category{ ... @0neToMany @JoinColumn("category_id") List<Product> products; public List<Product> getProducts(); ... } When I call getProducts() I want to lock returned collection so that other transaction could not modify it while current one isn't comm...

Grails limit database column size

Hi, In my Grails app I have a domain class that has a property SearchPrivacy searchPrivacy = SearchPrivacy.PUBLIC where SearchPrivacy is an enum enum SearchPrivacy { PRIVATE('pr'), PUBLIC('pu'); final String id SearchPrivacy(String id) { this.id = id } static getEnumFromId(String id) { values()...

hibernate3 maven plugin:make hbm2java generate hibernate annotations instead of ejb3 annotations

Is there a way of forcing the hbm2java goal of hibernate3 maven plugin to generate java classes with hibernate annotations instead of ejb3 annotations? I really do not need ejb/jpa, and hibernate annotations would suit me better because of the better integration with grails. ...

How to define UserType' s name globally in Hibernate?

It's possible to use @TypeDefs annotation to define short type name for a UserType. But how to define it for entire application? ...

Spring HibernateDaoSupport keep the same Session ?

In the standalone application(single threaded command line tool) I am developing ,I use Spring +Hibernate. It has DAO and Service layers and for DAOs I use HibernateDAOSupport. The collections in domain model are lazy-loading. Since for lazy-loading I need to keep the Session opended,I open session at start of my application using: Hib...

Hibernate with MongoDB

I'm looking for resources showing how to integrate MongoDB with Hibernate (preferably from within spring) so that I can switch between a RDBMS and a NoSql alternative: does anyone have experience doing this? ...

how to get Updated data using same Httpservice in flex

I have a flex form which has two httpservice.one which accesses data from the servlet and one which stores data into another servlet. Firstly when im accessing the data from the servlet that is working and the storing part is also working..so when i again call the access servlet im not getting the updated display..the access servlet is n...

How to use existing Oracle sequence to generate id in hibernate?

I have legacy oracle db with a sequence named 'PRODUCT_ID_SEQ'. And here the mapping of Product class for which I need generate correct ids: public class Product { @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "etailerRaw_seq") @SequenceGenerator(name = "etailerRaw_seq", ...