If I have this three structure in a table,
-A
|
*---B
| |
| *---C
| |
| *---D
| |
| *---E
| |
| *---F
| |
| *---G
*---H
*---I
|
*---J
assuming list() method is called and it returns a colleccion of B and H.
In this scenario I would like hibernate obtain C,D,I an...
I am trying to use one Hibernate mapping for several different databases: H2, Oracle, MySql.
Each database has a different list of reserved words.
I would like Hibernate to automatically escape the reserved words.
I know I can:
use backticks to force escaping (escape everything just to be safe)
change all identifiers so they are ce...
I wonder how can I pass a Java Date object from beans --> hibernate --> Spring MVC --> dojo and back to that Date object that would be stored in the database using hibernate.
I have tried, in beans class, creating getter and setter that return/get String by parsing the value to dojo friendly format (yyyy-MM-dd). When the date from the d...
The hibernate manual says this:
String sql = "SELECT ID as {c.id}, NAME as {c.name}, " +
"BIRTHDATE as {c.birthDate}, MOTHER_ID as {c.mother}, {mother.*} " +
"FROM CAT_LOG c, CAT_LOG m WHERE {c.mother} = c.ID";
List loggedCats = sess.createSQLQuery(sql)
.addEntity("cat", Cat.class)
.addEntity("mother", Cat.class).l...
Hi All,
I am using following data model (changed to make it simpler).
Table: STUDENT, TEACHER, BOOKS_ASSOCIATION, BOOKS_DETAILS.
Student and Teacher have a column whose forign key is BOOKS_ASSC_ID, hbm mapping as following
<many-to-one name="bookAssociation" class="com.example.BookAssociation" not-null="false" fetch="join" cas...
Hi,
I'm looking for a step by step tutorial on building small web application using Wicket, Spring, JPA and Hibernate assuming that the programmer is advanced in java but new to those technologies (so if the whole set up was included that would be perfect). Could anyone help?
Thanks in advance.
...
Hello everyone. I am trying to learn JPA and I have a problem that I stucked in since 2 days.
I have a table named "User" includes id,email,password,username and status.
As you guess email and username columns are unique.
I also have a Class called User something like that :
@Entity
@Table(name = "user", uniqueConstraints = @UniqueC...
Hello everyone. I'm having issues with a parent-child relationship here. When I persist from the collection side (child side) I get 2 new children instead of one.
Here is are the hibernate mappings:
<set name="children" inverse="true"
cascade="all,delete-orphan" lazy="true"
order-by="CHILD_ID desc">
<key...
I need a list with three columns. column 1st and 3rd having values while 2nd as null.
Can I do it through HQL query?
I need something like this:
select id, null, name from MyClass
Where MyClass as well as underlying table has only two properties/columns ie, "id" and "name"
...
Hello,
I am creating dependent drop downs using Struts2 jquery. The problem is that getLobList() method inside action class is causing hibernate to fetch all data for a lob. If I remove that getter method, those logs are not created. Why is this happening any way to fix it?
JSP page
<s:url id="remoteurl" action="getLists"/>
<sj:select...
I have an entity that has many-to-many association to itself.
If I needed some additional properties (like asked here) the answer would be to use a new intermediate entity. But without them is it bad practice to use direct many-to-many association to the entity itself?
...
Hi all, i have this situation:
I have an entity, "Person", that contains all personal details of a person, like birth date, street address, municipality ecc ecc.
And i have an entity "ClubMember" that describe a member of a club and contains some field like: registration date, type of member, credit, ecc ecc
So, a ClubMember is a Perso...
I'm new to hibernate. I have a transaction that fails with a HibernateException, yet the table is altered after the commit. Here is the code:
public StoreResult store(Entry entry)
{
Session session = HibernateUtility.getSessionFactory().openSession();
Transaction transaction = session.beginTransaction();
try
{ ...
I need both MyISAM tables and InnoDB tables in my database, I am using hbm2ddl to create them. Can I create both MyISAM and InnoDB tables in the same database using Hibenrate hbm2ddl?
It seems that selecting the dialect forces me to use one or the other.
...
Hi, i have entity A that has-a B entity, and B has-a A with @OneToOne bidirectional association.
Now, when i findall A records, hibernate perform two queries with a left outer join on B, something like this:
select a.id, a.id_b, a.field1, b.id, b.field1 from A as a, B as b left outer join b ON b.id=a.id_b;
select a.id, a.id_b, a.field1...
Hi i am making a school information software. Is there any third party reliable library that can be used for calculating grades of students referring marks for the same from specified database.It should be flexible enough to let client specify criteria for grade calculation in terms of standard deviation, median etc.
...
I encounter problem with Hibernate EntityManager 3.5.3-Final when it comes to composite predicates.
Example (not actual code snippet, but the idea should be clear):
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
Predicate predicate1 = criteriaBuilder.conjunction();
Predicate predicate2 = criteriaBuilder.conjuncti...
Hi
Here is my JPA2 / Hibernate definition:
Code:
@Column(nullable = false)
private boolean enabled;
In MySql this column is resolved to a bit(1) datatype - which does not work for me. For legacy issues I need to map the boolean to a tinyint not to a bit. But I do not see a possibility to change the default datatype. Is there any?
...
I develop application run in Websphere work manager. work manager is used to run thread in the webpshere applications erver.
Every 5 minutes my thread try to get some data from MySQL database from the different host from the application server machine.
When the Host of MySql database turned off, The work manager always try to connect t...
Im looking to create a generic DAO to handle CRUD in my hibernate app. My entities have most associations as LAZY fetching. But I find in order to have hibernate be efficient as possible with the SELECTs I have to create multiple methods on my DAOs. Here's what I mean:
Entity A has two associations. Sometimes I want to retrieve this...