How do I define an entity for the following table. I've got something that isn't working and I just want to see what I'm supposed to do.
USE [BAMPI_TP_dev]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[MemberSelectedOptions](
[OptionId] [int] NOT NULL,
[SeqNo] [smallint] IDENTITY(1,1...
I have a datamodel that has an intermediate table to manage relationships between entities.
For example, tables Person and Organization are related through the Relationship table
Party (table)
- ID
Person (table)
- ID (references Party.ID)
- name
Organization (table)
-ID (references Party.ID)
-name
Relationship (table)
-ID (PK...
I found out really strange behavior on relatively simple use case, probably I can't understand it because of not deep knowledges of spring @Transactional nature, but this is quite interesting.
I have simple User dao that extends spring JpaDaoSupport class and contains standard save method:
@Transactional
public User save(User user) {
...
Does any body know how if there is a way to tell if an entity is already in the NHibernate second level cache?
Ideally what I'd like to be able to do is pass the identifer of an entity to NH and find out if it's already in the second level cache.
...
in server.xml I've defined global resource (I'm using Tomcat 6):
<GlobalNamingResources>
<Resource name="jdbc/myds" auth="Container"
type="javax.sql.DataSource"
maxActive="10" maxIdle="3" maxWait="10000"
username="sa" password=""
driverClassName="org.h2.Driver"
url="jd...
Mapping an EMF model via Teneo/Hibernate works great. The default of mapping a Java String to MySQL results in the creation of a VARCHAR(255) column. This is too small for some entries.
I found out that the annotation @Column(length=4096) is what should help me out. But I cannot figure out where to append it. I tried the interface and i...
Hi,
I'm trying to retrieve a list of fields from a table using Hibernate that have unique constraints on them.
Is this possible? How can I do this?
Thanks
...
Let me describe my question -
I have a Java application - Hibernate as the DB interfacing layer over MySQL. I get the communications link failure error in my application. The occurence of this error is a very specific case. I get this error , When I leave mysql server unattended for more than approximately 6 hours (i.e. when there are ...
I want to persist my litte zoo with Hibernate:
@Entity
@Table(name = "zoo")
public class Zoo {
@OneToMany
private Set<Animal> animals = new HashSet<Animal>();
}
// Just a marker interface
public interface Animal {
}
@Entity
@Table(name = "dog")
public class Dog implements Animal {
// ID and other properties
}
@Entity
@Ta...
Hi,
Is there a way I can count the size of an associated collection without initializing?
e.g.
Select count(p.children) from Parent p
(there is a good reason why I cant do this any other way as my where clause is more complicated and my from clause is a polymorphic query)
Thanks.
...
I am testing my Hibernate DAOs with Spring and JUnit.
I would like each test method to start with a pre-populated DB, i.e. the Java objects have been saved in the DB, in a Hibernate transaction that has already been committed. How can I do this?
With @After and @Before, methods execute in the same Hibernate transaction as the methods d...
Given a classes Foo, Bar which have hibernate mappings to tables Foo, A, B and C
public class Foo {
Integer aid;
Integer bid;
Integer cid;
...;
}
public class Bar {
A a;
B b;
C c;
...;
}
I build a List fooList of an arbitrary size and I would like to use hibernate to fetch List where the resulting list will look so...
I have run into various StackOverflowErrors which occur during cascading. These have been extremely time consuming in debugging because I don't know which properties are being cascaded to cause this recursive behavior. Does anyone know of a log setting or some other form of debugging which could tell me specifically what properties are b...
I have a single lookup table that manages all lookups - legacy and new
lookup table structure is context,name, code, value
context is either legacy or new
name is the name of the lookup - state, status etc...for example
code is the code and value is the value associated with the code
Is there a way to specify multiple columns as discri...
Can someone tell me how to configure maven for it also to compile sources from the target/hibernate3/generated-sources directory? I have already read this and other posts but they don't seem to solve my problem (which indeed seems trivial).
I have used the bottom-up approach hibernate configuration for cfg.xml, hbm.xml and POJO generati...
I often use java.lang.Integer as primary key. Here you can see some piece of code
@Entity
private class Person {
private Integer id;
@Id
@Column(precision=8, nullable=false)
public Integer getId() {
}
}
I need to set up its precision attribute value equal to 8. But, when exporting The schema (Oracle), ...
Hi, I'm relatively new with hibernate so please be gentle. I'm having an issue with a long running method (~2 min long) and changing the value of a status field on an object stored in the DB. The pseudo-code below should help explain my issue.
public foo(thing) {
if (thing.getStatus() == "ready") {
thing.setStatus("finishe...
I've been struggling with this one for quite some time already. It appears a lot less simple than I thought it'd be:
<join table="COTISATION_SYNCHRO" fetch="join" optional="true">
<key column="COTISATION_SYNCHRO_COTISATION_ID_FK" on-delete="noaction"/>
<property name="cotisationCoupon" type="java.lang.Long" update="...
I have a question regarding an ArrayList of Integers, or primitive types in general. Suppose I'm designing a POS program and each product may have several prices.
Let's assume I can represent a price value with ints and in the Product class I have the field ArrayList<Integer> prices. What's the best way to map this with Hibernate?
I co...
We are using Wicket with Hibernate in the background.
As part of out UI we have quite long running conversations spanning multiple requests before the updated information is written back to the database.
To avoid getting hibernate errors with detached objects we are now using value objects to transfer info from the service layer to Wic...