I want to delete certain records from a table. These records have some child-records in other tables.
In order to be able to delete the main records, I have to delete the child records first.
Here is the example of the HQL used:
delete from ItineraryBooking ib where ib.booking.user.id = :paramId
Basically, this should remove all It...
Scenario:
In my application (which utilises an rich domain model, where the logic is in the model, not in the services) I have users. I create new users with a service
User newUser = userService.createNewUser("Hans Dampf");
or get them from the database
User oldUser = userDao.findByName("Hans Dampf");
Because in every call into my...
I'm using the latest version of Hibernate with Java.
I've got three enum types that are being used as property names, each of the three property names go with different objects. There are different sets of property names for each object.
Each property name is stored in a map with it's respective property value object, the property value ...
Hi all.
I use @AssertTrue annotation to ensure the execution of a method that sets some default values (always returns true). These set values are validated as @NotEmpty (these are Strings). So I need to guarantee that method annotated with @AssertTrue is executed strictly before that fields annotated with @NotEmpty.
Simplified code ex...
I have two Objects, Entries and Samples. Each entry has an associated set of Samples, and each Sample has a vote associated with it. I need to query the database for all Entries, but for each Entry I need the associated set of Samples sorted according to their vote attribute:
public Class Entry{
Set<Sample> samples;
}
public Clas...
I have grails project using my existing Java domain classes of a spring project and I need to configure typeDefinitions. In the spring project it is possible to configure this property of the LocalSessionFactoryBean - but how do you do that in a grails project?
...
Hi guys,
I have a question regarding mapping and entities/domains with Flex/Spring mapping via BDS. I currently have domains mapped to tables, and I am working off existing code to try and change the logic from web services to work with Blaze.
Now, i came across a value object used previously that mapped to a datagrid, but that value o...
I have a table with a generated id, but in some cases I would like to set it on my own. Can I, somehow, force Hibernate to ignore the @GeneratedValue?
...
Consider a situation where user 1 query the database thorugh application using hibernate(get or load or from customer where name = "gkp") he gets the data.After this a DBA manually updates that particular row by exeuting a update query in db.If a second user executes the same query will he get the updated data or the old one(which the us...
Hi everybody,
I have three classes -> Metadata, MetadataValue and MetadataMetadataValue:
Metadata
private long id;
private Metadata parent;
private long levelInTree;
private String code;
private String nameEn;
private String nameFr;
private String descriptionEn;
private String descriptionFr;
private String query;
private String metada...
I am learning JPA w/Hibernate using a Java SE 6 project. I'd simply like to be able to detect if the connection between Hibernate and my database (MS SQL Server) is open. For example, I'd like to be able to detect this, log it, and try reconnecting again in 60 seconds.
This is what I thought would work but isOpen() doesn't appear to be ...
Hello.
I have trouble with converting native SQL query to HQL.
Query is something like follows:
select count(*)
, sum(select count(*) from employee e where e.company_id=c.id))
from company c where c.id = someID
First returned value is count of companies, second - amount of employees for specified company.
I.e. I have to get this tw...
Assuming the following mappings are provided:
<class name="A" table="a_table">
<id name="id"/>
<many-to-one name="entityB" column="fk_B" not-null="false" unique="true"/>
</class>
<class name="B" table="b_table">
<id name="id"/>
</class>
Java class:
public class A {
private long id;
private B entityB;
// getters and se...
hi,
i am trying to do a 1-many polymorphic association and running into problems.
I have a table ATable, which needs to map to foo.A class.
foo.A has a one-to-many association with foo.I except foo.I is an interface.
ie,
public class A{
private Set< I > references;
..
}
I has two implementations I_1 and I_2 both of which map to tw...
I'm working on some data access logic with Spring, my question has to do with transactions. The transaction documentation http://static.springsource.org/spring/docs/2.5.x/reference/transaction.html shows that you can implement declarative or programmatic transactions. I've chosen to use the programmatic approach so that I have finer cont...
Hello,
I use JPA (Hibernate) with Spring.
When i want to lazy load a Stirng property i use this syntax:
@Lob
@Basic(fetch = FetchType.LAZY)
public String getHtmlSummary() {
return htmlSummary;
}
But when i look at the sql that hibernate creates, it seems this property is not lazy loaded? I also use this class org.hibernate.tool.i...
I am using Hibernate Annotations for the first time in my web application. In my bean, what type what annotations should I use to persist files uploaded by users?
...
In my web application, I have a text area whose user-filled contents are ultimately persisted to the db with Hibernate. I have been running into an issue that when the user input is beyond a certain length, the persistence fails. Is there a way to indicate through Hibernate Annotations or in the configuration that this particular field...
Hi Everyone
WHen deploying my Spring / Hibernate application, I get the following warning related to logging:
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
Surprising to me was the lack of information from a Google / SO search...
hello,
I encountered an common error with spring + hibernate, but cant fix it :(
i have 2 tables with one-to-many relation: each Bsc have many Cell
my hibernate config
<class name="Bsc" table="bsc">
<id name="id" column="id">
<generator class="native" />
</id>
<property name="name" />
<set name="cells">
...