Using @Scheduled in the spring

I have a component class @Component public class Scheduler { @Scheduled(fixedRate = 5000 ) public void test() { System.out.println("Hi"); } } But "Hi" is not being printed every 5 seconds. Why? My Confuration class is @ComponentScan( e

Insertable object in a class with @IdClass annotation

Is it possible to do a cascade save in Section.class? I create Section object and add new questions without id. When I try save it I get error: org.postgresql.util.PSQLException: ERROR: insert or update on table "question_to_section" violates fo

How to use Spring Page without spring data

Hi i'm using below code for find article using spring with plain hibernate. public List<Article> getArticles(int currPosition, int pageSize) { Criteria c = getSession().createCriteria(Article.class); c.addOrder(Order.desc("createdDate"));

Configure HSQLDB with maven

I'm developing a Spring application where everything is configured with maven (in pom.xml). My application uses a PostgreSQL database, but unit tests use an in-memory HSQLDB database. I just run into an issue with TEXT columns because they are not su

precision and scale in @column

Here I read that length in @column is only for generated DDL. Is this true for precision and scale? @Column(precision = 15, scale = 5) private Integer myField; If so: How to define precision and scale for JPA-validation?The JPA javadocs and spec (lin

How to plan a Hibernate program once a day

I am using Spring REST with Hibernate and I have developed a program in which data is coming from database calculate and it is updated into another table in database. But I want to run this program once in a day at a given time because I want to calc

Confusion with DBCP connection pooling and threads

I am trying to get Multi-Threading working in my Java web application and it seems like no matter what I try I run into some sort of issues with connection pooling. My current process is that I have am looping through all my departments and processin

RunTimeException What is the cause?

I try to build this jpa project but running into the same error. I updated, changed everything still nothing. What am I missing? I only use EclipseLink (JPA 2.0) in the libaries. NetBeans IDE 7.2. An annotation processor threw an uncaught exception.

How to convert this statement from MySQL to HQL?

This is the SQL statement: SELECT opc.contenido, COUNT(r.idOpcPregunta) from Opcionesrespuestas as opc LEFT JOIN Respuestasimples as r ON r.idOpcPregunta = opc.idOpcPregunta where opc.idPregunta ='6' GROUP BY opc.idOpcPregunta; This is a HQL select o

call to the primitive JPA method throws WrongClassException

public static UserDetail UserDetail.findUserDetail(Long id) { if (id == null) return null; return entityManager().find(UserDetail.class, id); } We are using spring Roo. Above is Roo generated finder method. Partial stack trace is as follows: Caused b

Can not retrieve hibernate result?

I can't extract result in hibernate.. I want to check an account when they sign in but it throws an exception: could not extract result. My sample code: My Pojo: @Entity @Table(name = "account") public class TestAccount implements Serializable {

Hibernate Nested Query Using Criteria

Is it posible to create a criteria for generating below sql: select name from (select distinct name from person) as aliasname order by lower(name); here there are two sql - select distinct name from person select name from <output of 1> as aliasname

Can we use JPA2 annotations to cache associations?

I'm now using the JPA2 @Cacheable annotation on my Entities, and all is working well. I now need to cache a ManyToOne association. In classic Hibernate, it was necessary to annotate the association with @Cache. @org.hibernate.annotations.Cache(usage=

Adding functional level constraints with Hibernate

I would like to define an entity which contains a list of something (for example embeddable) and each of these embeddables have a property active. At once, only one element inside the list is allowed to be active. How does one implement this in Hiber

JPA Hibernate Maven test - & gt; unknown class

I'm trying to run a simple dataImport class which is using JPA and Hibernate. If I run my class, i always have the following error: Exception in thread "main" java.lang.IllegalArgumentException: Unknown entity: ch.itartis.relman.entities.code.Re

JPA or Hibernate with Oracle table partitions?

I need to use an Entity framework with my application, and I have used table - partitions in Oracle database. With simple JDBC, I am able to select data from a specific partition. But I don't know whether I can do the same with hibernate or Eclipse l

FieldBridge for timestamping in Hibernate

What is the FieldBridge for timestamp in HIbernate Search? @Field public java.sql.Timestamp approvedDate;When looking at the BridgeFactory source code, it seems there is no default FieldBridge for timestamps. I think you should provide your own custo