hibernate

ireport - Can't load subreport data using Hibenate

I have two reports. A master report named report1.jrsml show id from table student and a subreport named abc.jrsml show data from table studentfile. Table Student Table Studentfile I use data source expression, when I run on webserver and invoke report from web application I have a result like this Image . It's wrong! I would l...

Why is EhCacheProvider deprecated?

I am configuring my hibernate project to use a 2nd-level cache provider, so that I can take advantage of query caching. I added a dependency to ehcache: <dependency> <groupId>net.sf.ehcache</groupId> <artifactId>ehcache-core</artifactId> <version>2.2.0</version> </dependency> I think that the provider class I want t...

Hibernate Criteria Projection

Well as the question says, i am trying to make a projection criteria querying only couple of the table attributes. So I have a Person Table/class and it has about 40 attributes i want my criteria to get dynamical number of attributes, lets say 10, 11 or 12.(sql terms "select firstname, lastname from person") and i was doing it like this ...

Map Struts tag s:checkboxlist by Hibernate?

Hello all, How to map Struts tag s:checkboxlist by Hibernate? For example, in the following I know company field in auth.hbm.xml is wrong. How do I correct this? Thanks! Model: String a[]={"browse","add","delete","update"}; boolean company[]=new boolean[a.length]; JSP: <s:checkboxlist name="auth.company" list="%{auth.a}" key="comp...

Books/tutorials that learn by writing an appliaction?

Ok so how I see it the best way to learn is to write a real app so I've been wondering are there any books/tutorials that get you through different languages/frameworks by writing a single app and not by showing some random code snippets. What I mean is that in chapter one we create the app, then in chapter 2 we add some features and inc...

javax.persistence/hibernate inside play

Hi, I'm new to both hibernate and java, I'm trying to define a simple user->groups->permissions model in playframework, I want the on delete cascade rule enforced at database level and I don't want the orm care about cascade (something similar to python-sqlalchemy passive deletes), here are my models: User model: @Entity @Table(name="...

How do I resemble the typical "confirmation of account" procedure seen in multiple websites?

I want to resemble the typical "confirmation of account" procedure seen in multiple websites. When a user registers an email is sent to him with a confirmation link. Once the user goes to that confirmation link its account gets confirmed. Don't worry about the email sending process. The thing is that I need to generate a URL to which the...

Hibernate deleting all rows before inserting ...

hi, Im new to hibernate... I have this entity class, the first one i built to test Hibernate, it uses an oracle sequence to fill the ID field : @Entity @Table(name="COMPANIES") public class Companies { private Integer cmpid; private String cmpname; private String cmpcountry; ...

map default column value with annotations

@Entity @Table(name = "J_CNTRY") public class CountryEntity { @Id @GeneratedValue(strategy = GenerationType.TABLE, generator = "myTableGenerator") @TableGenerator(name = "myTableGenerator", allocationSize = 5, pkColumnName = "pkName", valueColumnName = "pkValue", table = "j_cntry_pk_table") private Long id; private ...

Howto implement Spring Security User/Authorities with Hibernate/JPA2?

I am trying to implement DAOs to work with Spring Security database authentication in Hibernate/JPA2. Spring uses following relations and associations in order to represent user & roles: repesented as postgresql create query: CREATE TABLE users ( username character varying(50) NOT NULL, "password" character varying(50) NOT NULL, ...

how to fix the session factory using the hibernate tools with eclipse?

I get an exception when i try to use the dao class that hibernate tools generates like this: Could not locate sessionfactory in Jndi... I don´t know how to fix that.. If anyone can help me, i will appreciate a lot... ...

Hibernate sql exception when table empty.

The following code causes an exception when the Job table has no rows. public List<Job> getAll(int currentPage, int pageSize) { return this.sessionFactory.getCurrentSession() .createCriteria(Job.class).addOrder(Order.asc("id")) .setFirstResult(currentPage * pageSize).setMaxResults(pageSize) .setFetchSize(page...

org.postgresql.util.PGobject cannot be cast to org.postgis.PGgeometry

When I try to load points from a PostGIS database, I get the following exception: Caused by: java.lang.ClassCastException: org.postgresql.util.PGobject at org.hibernatespatial.postgis.PGGeometryUserType.convert2JTS(PGGeometryUserType.java:75) at org.hibernatespatial.AbstractDBGeometryType.nullSafeGet(AbstractDBGeometryTy...

NHibernate 'touches' my native ISQLQuery

In the application I'm developing, I am using NHibernate as ORM. My app has to support SQL Server, and MS Access (I'm using the NHibernate JetDriver). Now, the thing is that I have a certain query which I cannot achieve using HQL or the ICriteria API; so, I'm using an ISQLQuery for that one. Now, what bothers me, is that it seems that ...

Oracle CLOB and JPA/Hibernate ORDER BY?

I have a JPQL query that works fine with MySQL and SQL Server. But with Oracle it fails with ORA-00932: inconsistent datatypes: expected - got CLOB. The reason seems to be that Oracle does not support ORDER BY with CLOB columns. Is there any JPQL work around for this? ...

JPA or Hibernates With Oracle Table Partitions?

Hi, 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 link (JPA). If someone knows how to do that, please do let me know. usually the sel...

Hibernate One to many

As per hibernate documentation: To map a bidirectional one to many, with the one-to-many side as the owning side, you have to remove the mappedBy element and set the many to one @JoinColumn as insertable and updatable to false. This solution is not optimized and will produce some additional UPDATE statements. @Entity public class...

Force Hibernate query to access database

I have loaded an entity into my transaction and have changed a property of that entity. The transaction is not yet commited. Now I would like to get the original value of the changed property. I've tried with a HQL query like select p.property from Person p where p.id = 1 with the ID of the entity loaded in the transaction. I've set q...

updating parent-children relation not just value of child records

I have two tables in parent-children relation. On update, I have to update the relation between those meaning new children of parent may be added or one of the child record can be deleted. I know I can use update to update value of the children but in this case I have to acutally update the relationship of childen to parent. One way to d...

Problem connectiong to a SQL Server 2008 named instance using Hibernate

Hi, I'm using Hibernate to connect to an SQL Server 2008 named instance. This works if I use the default instance name but not when using the "named" instance. config.setProperty("hibernate.connection.url","jdbc:sqlserver://127.0.0.1\INSTANCE_NAME:1433;databaseName=DB_NAME;autoReconnect=true"); Any ideas why this happens? Thanks i...