hibernate

Logging JDBC/Hibernate/JPA transaction isolation levels

I'm working on a Flex/BlazeDS/Spring/JPA/Hibernate web application hooked up to a Microsoft SQL Server database. It seems to be locking the tables too aggresively. From my research, it looks like using the snapshot isolation policy is the best bet. I've set things up as such: <bean id="entityManagerFactory" class="org.springf...

Hibernate and Servlets

Hi all I'm developing a web-app and I want to retrieve data from the database and send them to the homepage.I thought to set the servlet as my welcome page,retrieve my data from the database,redirect to the homepage and pass my data as parameters.Any better ideas? ...

Orphans remain in database even with orphanRemoval=true on one-to-many relationship (JPA/Hibernate)

@Entity @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @Table(name = "company_policies") @DiscriminatorColumn(name = "rule_name") public abstract class AbstractPolicyRule implements Serializable { @Transient private static final long serialVersionUID = 1L; @Id @GeneratedValue private Long id; private String value; ...

The difference between annotating fields and methods in JPA (Hibernate)?

Are there any statements in JPA spec or official docs about certain JPA implementations which describe the behavior when we annotate entity's methods and when we annotate entity's fields? Just a few hours ago I met an ugly problem: I use JPA (via Hibernate, but without anything Hybernate-specific in java code) with MS SQL Server. And I ...

naming conventions in Hibernate

could any one please tell me what is the naming convention the Hibernate developers fallowing to give names for DAO calass, Sesgleton class which create Single SessionFactory and retuns Session throug a static method, hibernate mapping files etc ...

Batch insert mode with hibernate and oracle: seems to be dropping back to slow mode silently

I'm trying to get a batch insert working with Hibernate into Oracle, according to what i've read here: http://docs.jboss.org/hibernate/core/3.3/reference/en/html/batch.html , but with my benchmarking it doesn't seem any faster than before. Can anyone suggest a way to prove whether hibernate is using batch mode or not? I hear that there ...

java.net.SocketException: Broken pipe

I get this error or my jsp page every day: java.net.SocketException MESSAGE: Broken pipe STACKTRACE: java.net.SocketException: Broken pipe at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92) at java.net.SocketOutputStream.write(Sock...

Is Hibernate deprecated?

Hi folks, this morning I was aboard a S-Bahn (German Subway) and I met a fellow student, who works for IBM. What he is doing there is JEE optimization. I told him about my little project. And he recommended not to use 'oldschool' hibernate. That's why my question is: Is Hibernate deprecated? (In combination with JEE/Web Development) ...

JPA native query and cache

Hi All, Does native query in JPA (createNativeQuery) supports caching? I am filling my own data transfer object because the sql query joins several tables and takes only several columns form them. Regards ...

Hibernate: Refreshing an object with specified entity-name

Hi! In my application, I have a model with mixed static (POJO) and dynamic (Map) entities. As I wanted to have unqualified entity names all over the place, I gave the mappings for the POJOs an additional entity name attribute: <hibernate-mapping package="com.hoerbiger.versuchsdb.common.domain"> <class name="Test" entity-name="Test"> ...

What is the use of bag tag in Hibernate?

i need to know how to use the bag tag and what is the purpose? ...

JPA Entities with JoinColumn of two columns

I have this escenario... I have three 4 entities {orderItem, suppliers, supplier, prices}, and they are related like: OrderItem 1->* suppliers (some one item can have many supplier prices) Suppliers 1->1 supplier Suppliers 1->1 itemPrices and it's properties OrderItem {orderId, partId, quantity, suppliers} Suppliers {orderId, part...

Problems with persistence jars

Hello. I'm struggling with JBOss and I'm stuck on a problem which seems trival to fix but it turns out I can't. When I try to deploy a simple java web app I encounter an exception: org.hibernate.ejb.HibernatePersistence cannot be cast to avax.persistence.spi.PersistenceProvider I know that this is a problem with having more then one ...

Problem with Hibernate findById

have a peculiar problem with hibernate. I have a hibernate function like this. @SuppressWarnings("unchecked") public List<AppResponse> findByResponseId(long requestId) { return (List<AppResponse>) jdbcReference.getSessionFactory().getCurrentSession() .createCriteria(AppResponse.class).add(Restrictions.eq("requestId",requestId)...

'table per subclass' or 'table per class hierarchy'

Hi, I am using FNHibernate and its default is 'table per subclass' for inheritance mapping. This seems to be the cleanest way to do things but it has its downsides too. My problem is that I have to seed the database with lots of tab separated data. I have tried to do this via repositories/services (i.e. via FNHibernate) but this is ver...

Retrive List of parent which doesn't have child and if it has, apply condition in hibernate

Hi, I need to fetch List of Property(parent) Objects, if the Property has the Child object called propertyConcern i need to verify whether this propertyConcern is mapped to statement(verifying in detach query). // Fetches associated Properties DetachedCriteria subquery = DetachedCriteria.forClass( Prope...

Hibernate queryCount with a condition

Hello, I'd like to make an hibernate query. My old query was like : public int getPublicationCountVote(Publication pub,Boolean voteType){ return HibernateUtil.queryCount(SocialVote.class , new String [] {VOTED_PUBLICATION_ID_FIELD, FOR_OR_AGAINST_FIELD} , new Object [] { pub.getId() , voteType }); } But now, ...

Spring-Hibernate used in a webapp,what are strategies for Thread safe session management

I'm developing a web app with Spring and Hibernate and I was so obsessed by making he application thread safe and being able to support heavy load that based on my boss recommendation I end up writing my own session and a session container to implement a session per request pattern. Plus I have a lot of DAOs and me not willing to write t...

Hibernate Mapping on a View

Hi, Can a hibernate mapping be made on a View in the db? thank you manu ...

Hibernate criteria/filtering - only return elements in collection that are specified in the criteria

Hi, I have four hibernate classes: Trader, Legal, Party and Relation. Trader and Legal are types of party so extend it. A Trader can be related to a legal, a trader can be related to a trader and a legal to a legal. Both types can b the child or parent in the relationship. These relationhips are maintained in the Relation class. Both...