Formula 2 « Core « JPA Q&A





2. Incorrect sql query using Formula    forum.hibernate.org

3. Help with formula field    forum.hibernate.org

Hibernate version: 3.0 Hi! I am writting hibernate mappings for my POJOs and i got a doubt: I have two Entities: Pendency and Movement Each entity have its own table. A Movement holds the change history of a Pendency, so it is a many-to-one relationship. My doubt is for Pendency mapping. It is not useful for our model to have a ...

4. U a Guru? How to use formula with dynamic values?    forum.hibernate.org

...

5. HQL in formula    forum.hibernate.org

6. Formula and joined columns    forum.hibernate.org

7. formula property set to null    forum.hibernate.org

8. DB2, Criteria.addOrder does not work on formula properties    forum.hibernate.org

Newbie Joined: Wed Oct 11, 2006 4:42 am Posts: 8 Hi, I can't get the "order by" on criteria searches to work with computed columns on DB2. The following works well with MySQL. I have two classes in my model, Foo and Bar. Foo.java: Code: package model; public class Foo { int id; private int ...





10. formula in many-in-one for exotic join    forum.hibernate.org

Thanks. Your method is one of the possible solution. But since I'd like to have a java class mapped to this entity, I have to use a hbm.xml mapping. I kind of solving my problem by create a view with the join and map this view to a java class. Since I only need to fetch the rows, never do remove ...

11. Problem with Formula    forum.hibernate.org

Hi, I have two problems, one is calculating the date (to calculate n day after a date) and the other one is that I should follow the foreign keys to find the appropriate Equipment of each EquipmentInstance (which I couldn't do we Criteria). If you have any other solution (Criteria, HQL, ...) that may help me, I will be grateful. Thanks ...

12. How to use formula?    forum.hibernate.org

Hi, I have this in my mapping file: but when I try to use it, it say the column bonnen doesn't exist. Of course it doesn't exist, I want to return a formula result, not a database column. I've tried different queries, but all with the same result. I've also tried to with and ...

13. SerializationException again. Now with @Formula column    forum.hibernate.org

Hello, again a stupid question, but i can't find a solution in a forum/goolge: My mapping Code: @MappedSuperclass public class Entity implements Serializable{ @Id Long id; .... } @Entity public class Bid extends Entity{ private static final long serialVersionUID = ...; } @Entity public class Offer extends Entity{ private static final long serialVersionUID = ...; @Formula("( select distinct bid.ID from rwo.BID ...

14. One-to-one with formula. Bug?    forum.hibernate.org

Hi, forum. I'm trying to use one-to-one mapping with formula. I have a domain class, within domain there has a list of OU object, but only one OU is root OU which parent ou is null. I want to have root OU in my domain object. So, I define them as: ...

15. set case when ... from the    forum.hibernate.org

I want to use a "case ... when ... then ... else ... end" statement from hibernate, but only know the condition values at run time. I have been searching all day and have not found a good way of doing this. I would rather use HQL, but the only option I have found is to put SQL in my code. ...

16. Forcing @Formula field to recalculate    forum.hibernate.org

Hello, See code snippet below for reference. I have a 1:m relationship between Project and Capex. I have a @Formula computed property in my Project that adds up the total amount values of the Capex entities related to the Project. It works and computes the right total except when I add/delete/modify a Capex the old computed total is sometimes still maintained ...





17. Formula not working.    forum.hibernate.org

18. @Formula and Java enums - is it possible?    forum.hibernate.org

public class MyEntity { ... Day day; @Formula("CASE" + " WHEN NUM=1 THEN 'MONDAY'" + " WHEN NUM=2 THEN 'TUESDAY'" + " END") public Day getDay() ...

19. Property formula does not get evaluated    forum.hibernate.org

20. Parametr of formula    forum.hibernate.org

21. Order by and formula    forum.hibernate.org

Hi. I am trying to learn more of Hibernate by trying to make some forum. I have a Forum class, a Thread class and a Message class. I would like the Forum to have a collection of threads that are ordered by the latest message date. Code:

22. Cast in formula    forum.hibernate.org

Here is a snippet of my mapping file Code: ... case when (select mt.MT_MBR_NMBR_IND from MX_MEMBER_TYPE mt where mt.MT_CODE ...

23. many-to-one formula order problem    forum.hibernate.org

Hi, I noticed the next problem while deploying my application on multiple machines : I have a many-to-one association between one class (irrelevant) and my object of type ApplicationType. The object of type ApplicationType has an embeddable id. When referring to that table in my mapping file, i use 3 formula sections. When running the application, behind the scenes hibernate does ...

25. Executing stored functions in formula    forum.hibernate.org

Hi, I am working on using Hibernate on a legacy db system, which uses stored functions in Oracle. I tried to invoke one of these functions by using the formula attribute in property as the function simply returns a varchar so i was hoping that Hibernate would pass execution to Oracle which would just return the varchar and Hibernate would not ...

26. Formula on a many-to-one    forum.hibernate.org

27. formula based join syntax    forum.hibernate.org

Hello. I am using Hibernate 3.1 I am trying to do a condition based join on a 1-many relationship. I want to make a join with a record on the many side that has a date column to be null.I am able to join if I have condition with a specific date, but however I give the syntax, hibernate is not ...

28. Setting parameters in formula    forum.hibernate.org

I have a class which uses a formula to retrieve the count of specific items for a given user. Counting this items should occur on user_id and this property should be set dynamically into the formula I use. Is it possible to set parameters in a formula? Or should I get to this another way? (By using subqueries for example)

29. Derived Property using Formula    forum.hibernate.org

hi all, I am having issues in defining a formula for a Entity attribute. Basically there are 2 entities Account and TransactionRecord. On the Account entity I am trying to define a derived property "creditBalance" which will fetch the sum of all Transaction amounts. Code: ...

30. Running out of cursors in formula fields (3.2.5.ga)    forum.hibernate.org

Hello everybody I have found a problem related to calculated fields and cursors. When I insert an object with a derived property mapped as generated="always" the select executed (not the insert statement, the one that recovers the calculated value) doesn't free the database cursor and if this happens in a large enough loop you will have the following error: ORA-01000: maximum ...

31. Many-to-one with formula and not-found    forum.hibernate.org

32. Possible bug in Many-to-one with column + formula    forum.hibernate.org

33. Problem with a Formula definition    forum.hibernate.org

We are working on Oracle9i and our mapping is made with annotations. We want create a new attribute in our mapping which is defined by this formula @Formula(value="(select "+ " concat(concat(concat('CONTRATADAS:',cont.CONTRATADAS),concat(',PLANIFICADAS:', cont.PLANIFICADAS)),concat(concat(',EJECUTADAS:', cont.EJECUTADAS),concat(',DISPONIBLES:', cont.DISPONIBLES)))" + " from table(cast(gnomo.gn_prevencion.horas_contrato(18642,1,1,null) AS GNOMO.GN_TAB_HORAS_CONTRATO_PRV)) as cont " + " )") When we request for an object, hibernate translating from hql to sql inserts an alias ...

34.  tag    forum.hibernate.org

public class User{ private Integer userId; public User(){ } public Integer getUserId(){ return userId; } public void setUserId(Integer userId){ this.userId = userId; } }

35. How evil is this... Am I using formula improperly?    forum.hibernate.org

Newbie Joined: Sun Dec 23, 2007 3:44 am Posts: 3 Hibernate 3.2.5 GA on Mysql 5. I've found that the following subject is very difficult to search for, only because the key words are so pervasive. Basically I've got the following model. Users Groups UserToGroup (Group Memberships) Where UserToGroup's schema looks something like: userId, groupId, association-property1, index (I've mapped the memberhips ...

36. @Formula    forum.hibernate.org

Suppose i have a formula property such as: @Formula("select count(*) from T") public boolean exists() { return exists; } Now i want to use the result of this formula in some other query like i use other properties such as: "Select * from T where name like '%bla%' and exists = true" I cant make this work, cuz the amount of ...

37. Problem with Formula in many-to-one Relationship    forum.hibernate.org

38. org.hibernate.test.onetoone.formula    forum.hibernate.org

39. NPE using property formula    forum.hibernate.org

Hi, I'm simply trying to use formula... I have a mapping class and a Unit Test who run OK But when I had a simple I'm using Spring ...

40. order by formula with sybase    forum.hibernate.org

I seem to be having a sybase-specific problem with criteria.addOrder(Order.asc("someproperty"));, when "someproperty" is a formula instead of a column. I'm using SybaseDialect, and it seems that when I try to order by a formula, I get an exception from my driver stating the following: "Subqueries are not allowed in an ORDER BY clause." of course, this is somewhat expected because you ...

41. @Formula and Lazy    forum.hibernate.org

...

42. Use secondary table in @Formula    forum.hibernate.org

43. Formula and native SQL queries    forum.hibernate.org

@Formula (value = "amount - amount_paid") public Double getAmountDue() { return amountDue; } public void setAmountDue(Double amountDue) { this.amountDue = amountDue; }

44. Many-to-many with formula tag    forum.hibernate.org

Hi, Im trying to map a many-to-many relantioship, with the tag:

45. Using formula-based property causes invalid SQL code for chi    forum.hibernate.org

Hi, I am facing the below issue, which was reported in JIRA on 26/Jan/06(see below URL), but seem it is not fixed yet. Is there any workaround for this? Please help me, it's very important for me. Thanks. URL : http://opensource.atlassian.com/project ... e/HHH-1400 Using formula-based property causes invalid SQL code for children "subselect" query I have simple one-to-many relationship, mapped as ...

46. Correlated subquery referencing problem in Formula    forum.hibernate.org

Hello, I'm trying to use @Formula to computed a "balance" property, which is the sum of the "amount" property on a set of detail records. @Formula allows an SQL fragment, including subselects, as a property, so I'm trying to use a correlated subquery as I would in SQL. However I'm unable to refer to the outer table alias. The @Formula SQL ...

47. formula query not working with ROW_NUMBER ,PARTITION, OVER    forum.hibernate.org

Hi, When used the reserved words ROW_NUMBER ,PARTITION and OVER in formula query I am getting the error "ORA-00923: FROM keyword not found where expected". This is because Hibernate prefixes my formula query and doesn't seem to recognize the reserved words ROW_NUMBER PARTITION ,OVER , connect , start with etc. Below is the my formula query.

50. Problem with formula    forum.hibernate.org

Newbie Joined: Sat Sep 05, 2009 3:24 pm Posts: 3 Hi, I have a problem using a formula on a property field, the property field isn't set to the corresponding value when I query the database (HSQLDB). this is the class I'm using Code: @Entity public class DemandeConge implements java.io.Serializable { @Id @GeneratedValue ...