hibernate

Spring, JPA, Hibernate, Jetty 7 Integration

Have anyone successfully run any spring and JPA application in jetty 7? I am getting following exception. This application throws no error in jetty 6. INFO [main] org.eclipse.jetty.util.log - Logging to org.slf4j.impl.Log4jLoggerAdapter(org.eclipse.jetty.util.log) via org.eclipse.jetty.util.log.Slf4jLog INFO [main] org.eclipse.jetty.uti...

mapping Field with variable type using Hibernate Annotaion

Hi. how can I have a field with variable type in my class? I use hibernate annotation for mapping to DB. I tried to use java.io.Serializable as field's type, but it mapped to database as a 01 amount which is true if I get it's object and cast it to it's true type. but I need to run a query on this objects that needs true amount of field...

Hyperjaxb and Apache CXF

Hey guys, I'm trying to use Hyperjaxb3 with Apache CXF to generate persistence annotations from a WSDL-first web service. I've plugged the Hyperjaxb3-ejb-plugin into the cxf-codegen-plugin, like so. <plugin> <groupId>org.apache.cxf</groupId> <artifactId>cxf-codegen-plugin</artifactId> <version>${cxf.version}</version> <depende...

delete hibernate entity question?

i want to delete a row and cascade all foreign keys in hibernate i am new to hibernate and i want to know if there's a method to delete an entity>> session.delete(); like the session.save and session.update methods in hibernate? ...

why hibernate forcing serialization in session.get method

I see that hibernate's session.get() and load() methods is accepting only Serializable objects. As per my understanding of hibernate, it will generate an SQL statement and send it to DBMS. It will never need to send a java object over network. Why hibernate is forcing serialization on us? ...

list-index hibernate ?

Hi I am bit confusion of list index type,my mapping file has like below <list name="transactionItems" cascade="save-update,delete-orphan" lazy="false"> <key column="TRANSACTION_ID" /> <list-index column="IDX" /> <one-to-many class="TransactionItem" /> </list> whenever hibernate load a mapped object,its through exception ...

Tomcat error with Hibernate 3.5.1

I just upgraded to hibernate 3.5.1 and I get an error now saying: java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval () Z. This only happens with Tomcat not with Jetty. I've checked and I don't have any conflict and this method definitely exists. I have hibernate-jpa-2.0-api-1.0.0.Final.jar on the class path, and...

How can I drop table if Entity Mode in Hibernate properties is Dynamic-Map?

Hi all, My application is creating tables dynamically using entity mode as dynamic-map in hibernate properties. Tables are generally network devices having their attributes as columns of table. Requirement is if device is deleted from database, its table will be deleted. Can i drop table using hibernate tools dynamically? ...

Difficulty setting ArrayList to java.sql.Blob to save in DB using hibernate

I'm trying to save a java ArrayList in a database (H2) by setting it as a blob, for retrieval later. If this is a bad approach, please say - I haven't been able to find much information on this area. I have a column of type Blob in the database, and Hibernate maps to this with java.sql.Blob. The code I'm struggling with is: Drawings dr...

How to get a list of the columns (in order) in a database table using a Hibernate session?

Hi, I need to retrieve a list of the columns in a table in the order in which they appear. Is this possible using Hibernate? I've got a Hibernate session object, and I don't mind whether I can do it in Hibernate itself, or using JDBC. The database is MySQL, and the equivalent SQL command I want to execute is: "SHOW COLUMNS FROM " + t...

jboss cache as hibernate 2nd level - cluster node doesn't persist replicated data

I'm trying to build an architecture basically described in user guide http://www.jboss.org/file-access/default/members/jbosscache/freezone/docs/3.2.1.GA/userguide_en/html/cache_loaders.html#d0e3090 (Replicated caches with each cache having its own store.) but having jboss cache configured as hibernate second level cache. I've read ma...

How can you query for an object using one of its properties' id

I have two entities, say, House and People, where multiple people can live in one house. It's a unidirectional link where each Person has a field for which House they belong to, so the Person table has a column named house_id. I need to be able to return all the Person objects who belong to a certain House, but I only have the id of th...

Adding Hibernate 3.5.x to a maven pom.xml build

I added the JBoss Maven repo to my pom.xml file like this... <repositories> <repository> <id>jboss</id> <url>http://repository.jboss.org/maven2/&lt;/url&gt; </repository> </repositories> And I added Hibernate itself like this... <dependency> <groupId>org.hibernate</grou...

Hibernate (JPA) Entity with Static collection as a member

Is it possible to have a static collection as a member of a hibernate entity? Say I have an object Question: public class Question { private String category; ... } Would it be possible to populate a static Set<String> that is a distinct set of all categories in the Database? I know I could just query this, but I was wonderi...

hibernate executeUpdate IndexOutOfBounds

I am trying to use an HQL to perform a simple update in hibernate, but i can't seem to get it to work. i have a query template defined as: private static final String CHANGE_DEVICE_STATUS = "UPDATE THING" +"SET ACTIVE = ? " +"WHERE ID = ?"; and then i try to execute it like this: Session s = HibernateSessionFactory.getSession(); Q...

Hibernate Discriminator sort

I am trying to sort the records when queried on discriminator column. I am doing a HQL/ Criteria query for retrieving all the records. Here is my class: abstract class A { ... } @DiscriminatorValue("B") class B extends A { } @DiscriminatorValue("C") class C extends A { } When I return the records, I want it sorted on the discrimin...

Hibernate, Set keys, CompositeUserType and SQL Procedures

Hi, I am having some trouble with returning a non-empty Set into an object using Hibernate and a custom CompositeUserType key. I have a set of tables and views (simplified here): create table lang (lang_id,lang_cd); create table article (art_id,...); create table article_lang (art_id, lang_id,title,...); create view article_lang...

application specific seed data population

Env: JBoss, (h2, MySQl, postgres), JPA, Hibernate 3.3.x @Id @GeneratedValue(strategy = IDENTITY) private Integer key; Currently our primary keys are created using the above annotation. We expect to support a large number of users (~million users), what key should be used. Should it be Integer or Long or should I use the unsigned vers...

Hibernate: how to maintain insertion order

I have a list of entities where creation order is important, but they do not contain a timestamp to use for sorting. Entities are added to the end of the list as they are created so they will be ordered correctly in the list itself. After persisting the list using Hibernate the entities appear in the database table in the order that th...

Join map and refer to its key/value in HQL

Suppose I have a map: <map name="externalIds" table="album_external_ids"> <key column="album_id" not-null="true"/> <map-key-many-to-many class="Major" column="major_id"/> <element column="external_id" type="string" not-null="true"/> </map> How do I make a HQL meaning "select entities where map key's id...