select x from X x where x.a.id = :a_id --> Always 0 objects selected
Why does the above JPQL statement not work, but the one below work?
select a from A a where a.id = :a_id --> a_obj
select x from X x where x.a = :a_obj --> Always correct number of objects selected
Neither query throws an exception during execution, but a different n...
Given a lookup table:
| ID | TYPE | CODE | DESCRIPTION |
| 1 | ORDER_STATUS | PENDING | PENDING DISPOSITION |
| 2 | ORDER_STATUS | OPEN | AWAITING DISPOSITION |
| 3 | OTHER_STATUS | OPEN | USED BY OTHER ENTITY |
If I have an entity:
@MappedSuperclass @Table(name="LOOKUP")
@Inheritance(strategy=In...
Hi All,
Can I use newest version of hibernate 3.5 (3.5.0-3.5.2) as JPA1 provider with EJB3.0 on Glassfishv2?
I tried, but hibernate 3.5 required JPA2 spec and obviously this did not work with GFv2.
Thanks,
Anton
...
Just a quick question:
There's the entity (for example User) who is connected with the ManyToMany relationship to the same entity (for example this relation describes "friendship" and it is symmetric).
What is the fastest way in terms of execution time to check if User A is a "friend" of user B? The "dumb" way would be to fetch whole L...
I have a bind in the sql query (select * from users where name like '%?%') the bind set the ?
Now, if i want to search with like method everything work but if, without change the sql, i want to search the exact match i dont now how to do.
I tried some regexp int the textbox es:
_jon \jon\ [jon] and some others but nothing work properly....
Is it possible to perform date arithmetic using JPA/Hibernate? For example, I have an entity with a java.util.Date field indicating when the row was created. Is it possible to perform a query using JPQL and include date arithmetic on that field? For example, can I perform a COUNT(*) of rows and then GROUP BY the month in that field? ...
Hello, I am trying to save a SystemUser entity in JPA. I also want to save certain things like who created the SystemUser and who last modified the system User as well.
@ManyToOne(targetEntity = SystemUser.class)
@JoinColumn
private SystemUser userWhoCreated;
@Temporal(TemporalType.TIMESTAMP)
@DateTimeFormat(iso=ISO.DATE_TIME)
private ...
Hi all, im developing a java swing app and i would use hibernate for persistance.
Im totally new in jpa, hibernate and ORM in general.
Im follow this tutorial, its easy but the problem is the java class that descrive a table in db are made from the table with reverse enginering.
I want do the opposite process: i want make db table from...
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) {
...
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...
Hey guys,
I'm new to ORM stuff and I need some help understanding something.
Let's assume I have the following standard SQL query:
SELECT *, COUNT(test.testId) AS noTests FROM inspection
LEFT JOIN test ON inspection.inspId = test.inspId
GROUP BY inspection.inspId
which I want to use in JPA.
I have an Inspection entity with a one-to...
With a table created using this SQL
Create Table X (
ID varchar(4) Not Null,
XDATE date
);
and an entity class defined like so
@Entity
@Table(name = "X")
public class X implements Serializable {
@Id
@Basic(optional = false)
@Column(name = "ID", nullable = false, length = 4)
private String id;
@Column(name ...
I have just started studying Spring framework. My current goal is to access database from my bean through JPA (TopLink** provider) on Geronimo server. But I can't overcome the problem of getting entityManagerFactory.
The exception I get:
java.lang.IllegalStateException:
ClassLoader
[org.apache.geronimo.kernel.config.MultiParent...
I couldn't figure out how to cleanly do a tag cloud with JPA where each db entity can have many tags.
E.g
Post can have 0 or more Tags
User can have 0 or more Tags
Is there a better way in JPA than having to make all the entities subclass something like Taggable abstract class? Where a a Tag entity would reference many Taggables.
Edi...
I need some help in persisting data into a table that has not been mapped.
Our database has a table in which all of its columns are foreign keys so by mapping the whole database all of the tables are correctly mapped. However that table called "category" is not mapped. We browse the data by passing for the table I mentioned using the...
I'm using JPA on Google app-engine datastore and some of the 'merge' operations are extremely slow. One of them usually takes more that 16 seconds. What can cause this?
--Update:A major part of the problem was caused by a concurrency issue. Now it's 3-5 seconds. (Just for the last 5 lines of code)
The code is something like this:
Paren...
I am currently trying to wrap my head around working with JPA. I can't help but feel like I am missing something or doing it the wrong way. It just seems forced so far.
What I think I know so far is that their are couple of ways to work with JPA and tools to support this.
You can do everything in Java using annotations, and let JPA (wh...
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 the following annotated Hibernate entity classes:
@Entity
public class Cat {
@Column(name = "ID") @GeneratedValue(strategy = GenerationType.AUTO) @Id
private Long id;
@OneToMany(mappedBy = "cat", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
private Set<Kitten> kittens = new HashSet<Kitten>();
public v...
Hi all,
I have a query factory that takes a column name as an attribute in order to search for that column. Right now I'm passing the name of the column as a string, so it's kind of hardcoded. If the name of the column changes in the entity's annotation, that "hidden dependency" breaks up.
Is there a way in jpa to retrieve the real na...