I'm currently rebuilding an existing PHP application using Java. I therefore have an existing frontend GUI and an existing database schema that I'm working with.
Here is the technology stack I'm working towards:
jQuery, client-side
Wicket, front-end
Spring, ???
Hibernate, ORM
MySQL, database
Before reading about Spring in both Wicke...
I'm looking for a way to set the "default" mapping that Hibernate applies to a variable name in a Java object to query it against the database. At the moment we are using the inline javax.persistence markup to manually set column names, but since we have a rigid naming policy for our database it would be nice to be able to just skip on t...
Our team is building an RCP application using PostgreSQL for DB. We are evaluating the usage of Hibernate. Our project has the following constraints :
1) The project is a small extract-and-run-in-any-system type RCP application which is mostly used by non-technical users with a minimum setup needed. The application should have a low mem...
My problem is the same as described in [1] or [2]. I need to manually set a by default auto-generated value (why? importing old data). As described in [1] using Hibernate's entity = em.merge(entity) will do the trick.
Unfortunately for me it does not. I neither get an error nor any other warning. The entity is just not going to appear i...
I need some help with Hibernate Projections.
I have a class called Activity with a property "duration" which is an Enum. Duration is a Integer field on the Oracle Database. I have annotated the enum.
@TypeDefs({
@TypeDef(
name = "Duration",
typeClass = GenericEnumUserType.class,
parameters = {
...
All,
I'm probably over-analyzing this problem, but...
Given table "A" with two one-to-many relationships "A1" and "A2", return all records in table "A" that have at least one child record in either table "A1" or "A2"...
I'm not necessarily interested in knowing what the child data is, but rather that I just have child data.
Thanks!
...
Hi! I'm working on a program to store and manage test results. Tests have properties like date, duration, and also results. However, some tests measure pressure, others temperature... I hope you get the idea. So, not every test has the same attributes.
My first thought was to extract the test results out of the test table into individua...
Hey there everyone ...
I´m using JPA with SPRING and mySQL and I´m having problems while removing an entity...
I am doing this:
@PersistenceContext
private EntityManager em;
...
@Transactional
public void delete(Long id) {
em.flush();
OwnerEntity e = em.getReference(Entity.class, Long.valueOf(id));
if (e == null)
throw new Ex...
How can I get all constraints for a class. For instance I have
class A {
@NotNull
private SomeBean field;
}
When I call:
ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
Validator validator = factory.getValidator();
Set<ConstraintDescriptor<?>> descriptor = validator.getConstraintsForClass(formClass).ge...
I'm having the hardest time getting Eclipse to connect and reverse engineer from a MySQL5 database. I can see Eclipse connecting to my MySQL database and can even see the tables through the "Data Source Explorer" view but when I try it after creating Hibernate Console and Configuration files, I get the error:
org.hibernate.console.Hibe...
hi guys,
I just realized that seam-gen creates wrong entities for one to many relationships by default. First it uses HashSet instead of List, how can I change that?
This is my schema:
category(category_id, category_description, workgroup_id)
subcategory(subcategory_id, subcategory_description, category_id)
This is what should be cre...
Coming from NHibernate, I've tried to do something like this in Java (first example):
http://ayende.com/Blog/archive/2009/06/03/nhibernate-mapping-ndash-ltmapgt.aspx
I have the following code:
public class Box implements Serializable {
private Long boxId;
private Map<String, String> properties;
public String getProperty(String ...
I'm primarily a Java developer who works with Hibernate, and in some of my use cases I have queries which perform very slowly compared to what I expect. I've talked to the local DBAs and in many cases they claim the performance can't be improved because of the nature of the query.
However, I'm somewhat hesitant to take them at their ...
In my model I have an abstract "User" class, and multiple subclasses such as Applicant, HiringManager, and Interviewer. They are in a single table, and I have a single DAO to manage them all.
User:
@Entity
@Table(name="User")
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(
name="role",
discriminatorTy...
I am using spring and hibernate and currently making test case for database test and i am getting this error
Error:
Before Test CaSe
SEVERE: Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@1e91a4d] to prepare test instance [com.Test.TestClass@bdc9b3...
Hi,
I'm looking for an easy-to-use and intergrate ORM for Wicket application. I was thinking about Hibernate. Is it a good choice? What are the possible problems with Wicket/Hibernate? Any other suggestions are welcome. Thanks for any help.
...
I am using JSF 2.0, Spring, Hibernate and I need to implement Log4J for centralized error catching. Can anybody help?
...
Hi all,
I want to develop a blog and image gallery system. My db schema likes below;
IMAGE {table} | ARTICLE{table} | COMMENT{table}
-------------------|------------------------|-----------------------
PK id; | PK id; | PK id;
PATH String; | FULLTEXT String | ENTITY_ID {IMAGE_ID, ARTICLE_ID...
Hi,
I have a basic one to many relation parent / child like in the chapter 21 of Hibernate references book.
The cascade is only from child to parent (persist cascade only because I don't want to delete the parent if I delete a child).
When I add a child to the parent and I save the child, I have a TransientObjectException...
@Entity
pu...
I am new to hibernate and I am having some trouble with the named query annotation. My code is as follows and is more or less generated by NetBeans
The BasicUser class:
package wmc.model;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Colu...