Ever since I started using an ORM for my day to day data access. I've started to think about how much I should rely formatting functions for my columns. By formatting functions, I mean such things as Oracle's decode(), instr() and initcap().
Example
Say I'm selecting this column using formatting in Oracle.
(to_number(to_char(to_date...
I created a JPA unidirectional join table following the JPA documentation very closely (http://www.jpox.org/docs/1_2/jpa_orm/one_to_many_list.html).
I could insert an applicant, A, with joblist (JobOne, JobTwo) without any problems. However, when I tried to insert a different applicant B, with a job already used by another applicant, e....
I make use of: NetBeans IDE 6.7.1, GlassFish v2.1, Oracle 10g XE, JAVA 6 SE, JAVA 5 EE.
I have problem with an @ManyToMany annotation:
@ManyToMany(fetch=FetchType.EAGER)
@JoinTable(name="CUST_RENT_MOVIE", joinColumns={@JoinColumn(name="CUST_ID")}, inverseJoinColumns={@JoinColumn(name="TITLE")})
private Collection<CustRentMovie> rents ...
I've activated the auto-detect mode of Eclipselink 2.0 to find @Entity annotated classes:
<exclude-unlisted-classes>false</exclude-unlisted-classes>
But Eclipselink tells me that I should add an ID to my Entity:
Caused by: Exception [EclipseLink-7161] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence...
I got a OneToMany relation between User and Group
Group.java
@Entity
public class Group {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String groupid;
@ManyToOne
@JoinColumn(name="USER_FK")
private User user;
...
}
User.java
@Entity
public class User {
@Id
@GeneratedValue(strategy = Generat...
It generates MyISAM tables by default. I don't want to have to get it to generate a DDL script and then edit that if I can avoid it. I would also like to avoid changing the default table type of my MySQL installation unless I can do that for online one database. Any ideas?
...
... right now, this is how I'm getting the id from save(entity) method:
Serializable save = hibernateTemplate.save(article);
return Integer.valueOf(save.toString());
Being a complete noob to hibernate, I just wonder if this is the proper way to do it?
I'll appreciate any advice.
Grateful in advance :-)
...
I am having a problem with Hibernate seeing my domain objects doing a purely annotation configuration for Hibernate.
I'm getting
org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [from User u where u.userName=:userName]
I thought all that had to be done was add the packagesToScan property for the sessionFactory and add @E...
Hi everyone,
This seems like such a bonehead question, but I've been chasing my tail around a tree all day. I have a Struts 2 + Spring3/JPA/Hibernate application that inserts a large set into the DB. In the set is a Java util date. I've checked the date just before the Dao inserts the rows and all the dates have the correct times. After...
I'm using JPA 2 with Eclipselink 2 and a Derby in memory db for my tests. When I start my little test programm I get the following exception:
[EL Warning]: 2010-08-12 17:17:44.943--ServerSession(948252856)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.Database...
I've only just started out with CF9's ORM features, and have run into a problem.
I've got a single table set up - member - which has 2 records in it.
If I try:
<cfscript>
members = EntityLoad("member");
writedump(members);
</cfscript>
...I should get an array of member objects; but I get the error:
unexpected token: member near lin...
Why can i remove elements of a bidirectional relation although only one side of the relation is managed in persistence context (Example I)? When i have an unidirectional Relationship that doesn't work (see Example II). Why?
Entities:
@Entity
Class User {
...
@OneToMany(mappedBy = "user")
private List<Process> processes;
...
Hi, there are two entity classes:
@Entity
public class Place implements Serializable {
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id;
@OneToMany(mappedBy = "place")
private List<Event> events = new ArrayList<Event>();
private String name;
//getters setters
}
@Entity
public class Event implements...
Hibernate mapping question where the behavior is ambiguous and/or dangerous. I have a one-to-many relationship that has a cascade-delete-orphan condition AND a where condition to limit the items in the collection. Mapping here -
<hibernate-mapping>
<class name="User" table="user" >
<!-- properties and id ... -->
<set table="em...
1.- I'm working Glassfish 2.1 with EcipseLink 2.0.0, so really using JPA 1.0 specification, and I have a stateless EJB that finds entities among other things. As far as i know JPA 1.0 defines a L1 cache that works at Persistence Context level (transaction level for stateless EJBs) but I can't figure out why the next code prints "Not same...
Hi. I'm an old-school database programmer. And all my life i've working with database via DAL and stored procedures. Now i got a requirement to use Entity Framework.
Could you tell me your expirience and architecture best practicies how to work with it ?
As I know ORM was made for programmers who don't know SQL expression. And this is ...
Question: I'm planning the database for one of my programs at the moment.
I intend to use ASP.NET MVC for the user backend, the database being on Linux and/or on Windows.
Now, even if I would only make it for windows, I had to take into account, that different customers use different database systems. Now, I figured I use nHibernate, t...
Hi,
I was following the documentation on FullTextSearch in postgresql. I've created a tsvector column and added the information i needed, and finally i've created an index.
Now, to do the search i have to execute a query like this
SELECT *, ts_rank_cd(textsearchable_index_col, query) AS rank
FROM client, plainto_tsquery('famille age')...
Hello,
I have some problem with @OneToMany and @ManyToOne annotations.
I have two class Suite and SuiteVersion. A SuiteVersion is dependent of a suite. So i have implemented this in my code:
Class Suite :
@OneToMany(mappedBy = "suite")
@Cascade(CascadeType.DELETE_ORPHAN)
private List<SuiteVersion> listSuiteVersion = new ArrayList<Sui...
I have a question with HQL query and hibernate.
I have a user class and a role class. A user can have many roles. So I have a ManyToMany relatation like this:
In user class:
@ManyToMany(fetch = FetchType.LAZY)
@oinTable(name = "PORTAIL_USERROLE", joinColumns = { @JoinColumn(name = "USERID", nullable = false, updatable = false) }, inve...