Complex 1 « Map « JPA Q&A





1. Calculated field vs Complex queries in a database (using JPA)    stackoverflow.com

We have a stock control system which manages the flow of certain items in and out of the business or given location. We have records in the db representing the movement ...

2. Best way to use hibernate for complex queries like top n per group    stackoverflow.com

I'm working now for a while on a reporting applications where I use hibernate to define my queries. However, more and more I get the feeling that for reporting use cases ...

3. Hibernate Complex type save    stackoverflow.com

i need to persist an object whose one of the properties is an enum. This whole structure have to be saved in a single table. The enum defines the possible genders public ...

4. Hibernate Self Join    stackoverflow.com

Background I have a table with columns id, imageId, propertyId. There could be many images associated with a single property and there could be many properties associated with a single image. imageId - ...

5. Hibernate complex Mappings    stackoverflow.com

We use a pesonal design to store modified rows. For the data we need to keep, we use 2 tables; the first with fields that don't change, the second uses soft ...

6. Hibernate complex query    stackoverflow.com

I am trying to execute a query against a MySQL database. The query is fairly complex it has 5 inner joins, including 1 join to itself and it returns 3 pieces ...

7. Hibernate HQL: how to use a complex left join fetch    stackoverflow.com

I want to add a left join on TASK table when the following condition occurs: LEFT JOIN FETCH ...

8. Unable to delete entity with complex parent-child relationships    stackoverflow.com

I have the following relationships in my entity table Table A

@OneToMany(mappedBy = "A", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@Cascade(value = DELETE_ORPHAN)
@OrderBy
private List<B> orders = new ArrayList<B>(0);

@OneToMany(mappedBy = "A", cascade = CascadeType.ALL, fetch ...

9. complex combine sql    stackoverflow.com

query 1 : this will count all the record with email 'emali@test.com'

select count(*) as total from userbase
join extrauserinfofromhrms on userbase.username = extrauserinfofromhrms.useremail
right join logevent on userbase.username = logevent.useremail
join eachworkflow on logevent.workflowid= ...





10. Hibernate Query with conditions in a complex db structure    stackoverflow.com

I have a complex database that's looking like this:

product *1 <-> n* inventory *n <-> 1* inventoryUser *1 <-> n* user
Now I would like to query e.g. all products where user.firstname ...

11. How can I add a complex order-by using Hibernate Criteria?    stackoverflow.com

I'm using Hibernate criteria and would like to add an order-by clause that is functionally the same as this SQL:

order by abs(dateSubmitted - 125234234)
Where dateSubmitted is a long and the number ...

12. Automatically Persisting a Complex Java Object    stackoverflow.com

For a project I am working on, I need to persist a number of POJOs to a database. The POJOs class definitions are sometimes highly nested, but they should flatten okay, ...

13. Complex SQL Query to NHibernate DetachedCriteria or HQL    stackoverflow.com

I have the following SQL Query returning the results I need:

SELECT     
Person.FirstName,Person.LastName,OrganisationUnit.Name AS UnitName, RS_SkillsArea.Name AS SkillsArea, Activity.Name AS ActivityName, Activity.CLASS, Activity.StartsOn, Activity.EndsOn, 

SUM(ActivityCost.CostAmount) / 

NULLIF(
 (
 ...

14. DDD and storing complex Value Object in db using Hibernate    stackoverflow.com

In the sample DDD project written by Eric Evans (http://dddcommunity.org/examples) there is a Cargo class which is an entity object and is mapped to db table using hibernate. That Cargo domain ...

15. Complex queries with JPA criteria builder    stackoverflow.com

Can some one suggets me how to build up following query using JPA Criteria builder api.

SELECT id,status,created_at from transactions where status='1' 
   and currency='USD' and appId='123' order by id
Its ...

16. For TestNG, what is the proper method for pre-populating the data source containing a complex model when it will be queried using Hibernate?    stackoverflow.com

I wish to write tests for our Seam Framework-based web site's internal search engine that uses Hibernate + Lucene indexing (on DB2) for queries. What is the best solution for populating ...





17. Complex Search Queries JPA    stackoverflow.com

In my Wicket+JPA/Hibernate+Spring project, much of the functionality is based around the Inbox page where, using many filtering options (not all of them have to be used), users can restrict the ...

18. Can you perform complex aggregate operations using NH3?    stackoverflow.com

I need to perform a grouping aggregation similar to something like this in T-SQL:

select b.Name as [Grouped Name],
COUNT(distinct a.ID) as [Grouped Count], 
COUNT(distinct c1.ID) as [Second Group Count], 
COUNT(distinct c2.ID) as ...

19. Complex order by in JPQL    stackoverflow.com

Let me start by saying I'm not a DB guy. This stuff just confuses me to death, but unfortunately I got roped into doing this at work, so I'm kinda stuck ...

20. Hibernate Criteria Class for making complex queries to database    stackoverflow.com

I'm developing a web application based on Struts2 Framework for implementing the MVC, and Hibernate3 for accesing the database by means of DAOs, and DTOs for mapping the relational objects in ...

21. Complex JPA persist order issue    stackoverflow.com

I'm working on a project with some unusual entity relations which i'm having problems persisting with JPA. There are two relevant objects; User and let's call the other X. User has ...

22. Complex JPQL ORDER statement    stackoverflow.com

I'm trying to write a fairly complex JPQL statement that sorts results based on a value in another table. I know what the MySQL would look like, but I need help ...

23. JPA 2/Hibernate - Best way to update complex entities?    stackoverflow.com

I'm new to JPA/Hibernate and I'm wondering, what is usually the best way of updating a complex entity? For example, consider the entity below:

@Entity
public class Employee {

    @Id
  ...

24. Hibernate Criteria restrict by aggregation    stackoverflow.com

Background

We carry out tests on multiple items on a regular basis, which produce test results (either pass or fail). A single test can be applied to multiple items, and a single ...

25. Complex query takes 30 seconds with no full table scan    stackoverflow.com

I'm running MySQL 5.1 on a 32 bit machine, I'm using Hibernate criteria to generate the query below; for some reason I don't understand it takes 30 seconds to execute even ...

26. Complex Full text search using PlayFramework Search / Hibernate Search    stackoverflow.com

Suppose there are only two type of model objects. Tag Article Article can have a variable number of tags, as well as a large text field containing the body of the article. How do I ...

27. Complex sentence on HQL    stackoverflow.com

I would like realize the following sentence on HQL. could someone help me to translate the SQL sentence to HQL? select distinct device.description from device, attribute where attribute.deviceid = 1 and device.nodeid ...

28. Complex Primary Key using Hibernate with Annotation    stackoverflow.com

I would like to generate a custom ID for an object, depending on values already in database. I know several questions were asked on that subject, but I can't figure a solution ...

29. Hibernate executes TWO queries instead of ONE for complex JOIN    stackoverflow.com

I'm having trouble understanding why I cannot get Hibernate to do a somewhat complex JOIN in a single query. I hunted down all of the EAGER initialized attribtues and either JOIN ...

30. Hibernate and a Complex many-to-one on Two Columns    stackoverflow.com

I have a BUSINESS table that looks like this:

BUSINESS_ID | BRN | CODE | PARENT_ID
A Business can have a parentBusiness, which is joined from child.parent_id->parent.brn and child.code->parent.code and can be represented ...

31. Hibernate unsaved transient errors when rendering a complex form with a many-to-many relationship    stackoverflow.com

Basic problem: I've got a many to many relationship (Stores, Products) with a lookup entity named ProductOffering. In the situation where I have a persistent StoreLocation and try to ...

32. How to merge complex business validation with JSR-303?    stackoverflow.com

I'm stuck with validation in my current use case. My app has standard structure (WEB <-> EJB3 Services <-> EJB3 DAO <-> DB). I have an entity which has validation annotations applied to ...

33. How to cascade persist a complex structure with generated ids?    stackoverflow.com

UML class diagram Say I have to first create and then persist the kind of structure shown here above; It is a structure to store a dynamic table with dynamically ...

34. Complex JPA relationship    stackoverflow.com

I need help to build a complex relationship among the following tables: enter image description here Here is the scenario: 1) 1 Family has N familyTypes (unidirectional) 2) 1 Family has N familyFields ...

35. How to write complex join query with JPA    stackoverflow.com

How to write this kind of complex join query with JPA, Some of syntax I have denoted below not work with JPA. I have used them for demonstrate way that sql ...

36. Refactoring complex project to JPA or Hibernate    stackoverflow.com

I have big enough and already working project, written not by a programmer, but a scientist. The program holds lot of data in a huge object tree. Almost all of the ...

37. JPA native query fails with complex type    stackoverflow.com

I'm quite new to JPA. I have to use a native query :

 "Select r.id, service , r.timestamp, r.successState, 
    sum(expectedTagsCount) as expectedTagsCount, 
    sum(validTagsCount) ...

38. Many to many complex hibernate mapping    stackoverflow.com

I have a DB scenario like this; Base tables:

STUDENT (student_id, name)

SPORT (sport_id, name)

SPORT_SUB (sport_sub_id, name)
Many to many mapping tables:
SPORT_CATEGORY (sport_id, sport_sub_id, sport_category_id) 

STUDENT_SPORT_CATEGORY (student_id, sport_category_id)
Can anyone suggest a way to map this ...

39. Complex Many-to-Many JPA CriteriaQuery    stackoverflow.com

I have two entities, Ablum and Image, which are in many to many relationship. I wanna make a criteria query that to get all Albums and the counts on how many Images ...

40. Hibernate: Using collection of complex objects throws exceptions    stackoverflow.com

I am looking into Hibernate and storing collections of complex types. But I run into exception. I have the following persistent class:

public class Item {

    ...

41. complex JPA inheritance with JAXB specific contract    stackoverflow.com

Hi guys I've searched everywhere for this, so this is literally a last resort, I am trying to get a nice database structure for the following code:

@Entity
@Table(name = "tasks")
@XmlRootElement(name = "task")
@XmlType(propOrder ...

42. Complex use case about JSR-303, Tapestry, and JPA entity inheritance    stackoverflow.com

I have a JPA entity called ParentAccount that extends an abstract Account entity (see JPA inheritance). I have place the JSR-303 validation constraints in the Account entity. Now I have the following ...

43. Moderately complex JPA HQL: subqueries & group by    stackoverflow.com

I have the following data model: SessionTemplate, this defines the base characteristics of a course, most importantly a String property denoting the 'color' of the course. SessionInstance, this holds course offerings. There may ...

44. Error: detached entity passed to persist - try to persist complex data (Play-Framework)    stackoverflow.com

I have a problem with persisting data via play-framework. Maybe it's not possible to achive that result, but it would be really nice if it would work. Simple: I have a ...

45. Complex hibernate criteria with subqueries on collections    stackoverflow.com

I have a requirement where I need to reproduce this query using a Hibernate criteria:

select
        top 500 this_.id_cobranza as id1_21_0_,
     ...

46. complex query in hibernate    coderanch.com

I am looking for writing a complex query in hibernate. Can anybody provide me useful tutorial. The scenario is: 1> I have to get the list of data(ie.object) from 1 table using where clause. and then for eve 2> Then for every item in the list I have to get the list of data(ie. object) from 2nd table. Both tables are ...

48. Complex HQL query conversion (from SQL)    coderanch.com

Hello, I'm having trouble constructing a query in HQL for my mapping. Please excuse the size of the following but I feel including the bits of code concered will help matters, (I've tried to remove fields/detail not relevent to this example). I have a database which maintains the status of an order. The current status of the order is determined by ...

49. Complex Objects with Hibernate    coderanch.com

Hi! I want to save complex Objects from Flex in a Database with Life Cycle Data Services and Hibernate (if possible, with the LCDS HibernateAssembler) but i have some questions about it. Example: I want to save the mx.controls.DataGrid Class from Flex because I want to save all individual changes from a special DataGrid. For this, I have to write a ...

50. I got rid of all complex data types in my Hibernate entities    coderanch.com

Advice on coding practices needed. I *am* big on OO; however, I am a Hibernate newbie, am under a deadline (who is not?), and the whole cascading business and all the complexity under the hood just drives me nuts. What, I have to keep an open Session or pre-load the whole structure?? An open session might not be a bad idea ...

51. Need help with a complex hibernate mapping    coderanch.com

Hi, I am looking at the mapping given on pg. 143 of Hibernate 3.0 reference manual. In a more complex example, imagine that the association between Employee and Organization is maintained in an Employment table full of historical employment data. An association to the employee's most recent employer, the one with the most recent startDate, could be mapped in the following ...

52. Complex HQL Query    coderanch.com

Okay, so I have the following classes. Class A (abstract class) ID Name Class B (subclass of A) Prop 1 Prop 2 Prop 3 Class C (subclass of A) Prop 4 Prop 5 Prop 6 One-To-Many with Class B Now I'm trying to write a query in order to select prop 3, prop 4, and whether or not there is a ...

53. Working with complex detached object graphs in EJB3 or hibernate in 3-tier architecture    coderanch.com

Thanks Billy, I guess creating another transient property for the purpose of flagging an entity dirty or new or deleted is really a manageable approach. I couldn't think of anything better than that unless I perceive keeping a separate collection of entities for every state a good idea. The project we've been doing has been manageable so far using this approach. ...

54. Complex math in HQL    coderanch.com

55. Very complex query with JPA CriteriaBuilder    java.net

I want to write a query in jpa criteriaquery. Here is the query: SELECT node.category_name, (COUNT(parent.category_name) - 1) AS depth FROM category_subcategories AS node, category_subcategories AS parent WHERE node.lft BETWEEN parent.lft AND parent.rgt AND node.category_name = 'PORTABLE ELECTRONICS' GROUP BY node.category_name ORDER BY node.lft Here is the code I come up with: CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery cq ...

56. A complex @OrderBy definition (JPA/Toplink)    java.net

Hi to All! I have an answer for this question. I look to new JSR-317 (JPA 2.0) and found this: Expanded object/relational mapping functionality, including greater flexibility in combining existing mapping options, support for collections of embedded objects, [b]multiple levels of[/b] embedded objects, [b]ordered lists[/b], combinations of access types, etc. For JPA 1.0 it's impossible.

57. JPA - A Complex Relationship Scenario. Help!!!    java.net

The domain objects concerned in this scenario are User, Mentor, Topic. User U1 can be a Mentor M1 of other User U2 in a particular Topic T1. Again, the same user U1 can also be a Mentor M2 for another User U3 in a Topic T2. Also, User U2 can be a mentor M3 of a fourth User U4 for a ...

58. complex query string : howto ?    forum.hibernate.org

Hi all, I'm a newbie to HQL \ EJBQL, and I hoping to get some help with the right way of composing a query string: (It's a Seam project) a Sale has a List of Items: Code: @Entity @Name("sale") public class Sale extends MyEntity { private List items = new ArrayList(); ...

59. Ordering a set. A complex case    forum.hibernate.org

I have the following mapping in hibernate 3.2.6: Code: ... more properties ... ...

60. Cannot figure out how to implement complex query    forum.hibernate.org

public class OfficeView implements java.io.Serializable { private Integer officeId; private List devices; @OneToMany(mappedBy = "officeView", fetch = FetchType.EAGER) public List getDevices() { return devices; } public void setDevices(List devices) { this.devices ...

61. Second Level Cache and complex properties    forum.hibernate.org

The following config is in my code that runs in production. I would like to use Second Level Cache on entity B and I generally run a query on entity A. My problem is, that B entities are not in the the cache, and Hibernate always runs a second select, that queries B from the database. It is possible to force ...

62. Help with complex hql query    forum.hibernate.org

Beginner Joined: Fri Nov 14, 2008 7:11 am Posts: 25 Hi, I have a quite complex and very long running query (> 15 minutes): Code: select new " + CustomerFeedback.class.getName() + " ( cus, cs, c, (select count(cd2) from ...

63. Converting a complex HQL-query to use the Criteria API    forum.hibernate.org

Hi. I'm having huge problems converting a specific HQL-query to using the Criteria API. I'll first start with my datamodel. Code: class User { ... @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @ManyToMany private Set businessUnits; ... } class BusinessUnit ...

64. Help with complex mapping    forum.hibernate.org

Hello there! We have the following schema: MEDIA{ ID} METADATA{ ID DESCRIPTION} MEDIA_METADATA{ ID_MEDIA ID_METADATA } METADATA_VALUE{ ID_MEDIA ID_METADATA VALUE } The whole idea here is that a Media has a collection of metadata elements. Each metadata has a collection of values. So let's say I have a metadata named "TAG" I would have just one entry on METADATA: ID:1 VALUE:TAG ...

65. Persisting the same complex object in different rows.    forum.hibernate.org

I'm using ids generated by hibernate for all my entities. I have one object that was persisted in hibernated in other session, so its id is already set. I want to persist it again but in other row, like if it was a new object. It is a complex object, many associations, so I don't want to "sweep" the object to ...

66. Complex Single Table Mapping    forum.hibernate.org

Hi, I'm relatively new to Hibernate (though I have done a fair amount of general JPA work) and I have having serious trouble finding information on the following. I would like to create an Entity that looks like (annotations/getters/setters omitted): public class TestEntity { @Id private Long pk; public ComplexPojo fieldOne; public ComplexPojo fieldTwo; . . .y public ComplexPojo fieldX; } ...

67. Mapping complex objects with big collections - pls advice    forum.hibernate.org

hi, trying to fully use the strength of OOP in my application i've reached a point where most of my objects have one common parent object (like Car objects which obviously has Wheels objects ). This probably isn't a bad thing as such as long as the parent object doesn't hold too much information. Unfortunately in my case my parent objects ...

68. Fetching strategy for complex object graphs    forum.hibernate.org

Hi, we are developing an application with a quite complex object graph. An extract of our domain model looks like this: Organsiation --1 ------- 1 -- User Organisation --1 ------- n -- OrganisationalUnit Organisation --1 ------- 1 -- OrganisationalUnit (root unit) Organisation --1 ------- n -- CampaignType Organisation --1 ------- n -- Campaign Campaign --1 ------- 1 -- Campaign (parent/child dependency) ...

69. HQL how to implement complex order by clauses?    forum.hibernate.org

hi i need to implement a non-trivial order by clause in HQL, but looks like i can't really do anything more than just plain field names. examples: 1. sort by "all the transactions that have specific credited account by parameter" (sorting by a boolean result - first all false values, then all true values) 2. sort by a different field that ...

70. Complex order by clause    forum.hibernate.org

I would like to express the following sql query with hibernate criteria but I don't know if it is possible: SELECT person.name, COUNT(person_addresses.address_id) FROM person LEFT JOIN person_addresses ON person_addresses.person_id=person.id GROUP BY person.name ORDER BY COUNT(person_addresses.address_id) DESC I have a class "person" (with field id and name, and a list of addresses) and a class "adress" (with id, street,...) I have ...

71. Complex Query in Formula Annotation    forum.hibernate.org

Hi guys, I have a calulated column in my bean which fetches data from 2 tables using unions and sums. Instead of executing the query for all my VOs inside a list and populating a transient field, I would like to use the @Formula annotation to fetch all data in a single query. This query works fine when executed as a ...

72. complex HQL problem    forum.hibernate.org

I cannot issue a complex query: select prof.lastName , course.courseTitle from Professor as prof inner join Course as course with course.professor.idProfessor = prof.idProfessor How can I do this? (this is the SQL equivalent select Course.courseTitle, Professor.lastName from Course inner join Professor on Professor.idProfessor=Course.courseId; ) The documentation for hibernate uses this syntax Table.column for where I have Course. But this is not ...

73. HQL how to express complex join with two paths.    forum.hibernate.org

Thanks for the answer and the link to the issue. This is my first hibernate project with some serious queries and I'm forced to go to native SQL. I might get around with a patched version, but I'm not that trained to get it done is reasonable time. Have people posted hibernate distribution with including this fix? Thanks, Erik

74. Complex sqlGroupProjection group    forum.hibernate.org

criteria.add(Restrictions.between("ctime", loRange, today)); criteria.add(Restrictions.eq("clientId", clientId)); criteria.add(Restrictions.gt("status", 0)); ProjectionList pl = Projections.projectionList(); pl.add(Projections.count("id")); pl.add(Projections.sqlGroupProjection(String.format("to_char(%s_.ctime - " + offsetHours + "/24, 'YYYY-MM-DD H24') as ctime", criteria.getAlias()), String.format("to_char(%s_.ctime - " + offsetHours + "/24, 'YYYY-MM-DD HH24')", criteria.getAlias()), ...

75. How do i project the result of the Criteria to a complex typ    forum.hibernate.org

Hi Hibernate Devs I'm trying to wirte some criteria to return the complex id or other complex object (e.g. parent) from a Criteria. However I keep on getting a org.hibernate.QueryException: property does not map to a single column: id How do i project the result of the Criteria to a complex type? Code: ...

76. best practice for working with complex object    forum.hibernate.org

Hello. Could anybody please recommend me what would be the best practice in my case? 1. My objects contains several one-to-many relationships with other objects, which in turn contain several one-to-many relationships. I do not want to keep an object in memory as a whole, so I use a lazy loading scheme. 2. A user works at a time with different ...

77. Complex mapping: map of lists of objects with one table    forum.hibernate.org

I have two tables Item and Custom_Relation. The Custom_Relation table describes abstract relationships between Items. CREATE TABLE ITEM ( ITEM_ID INTEGER NOT NULL, ... other values ... ); CREATE TABLE CUSTOM_RELATION ( CUSTOM_RELATION_ID INTEGER NOT NULL, ITEM_ID INTEGER NOT NULL, RELATED_ITEM_ID INTEGER NOT NULL, CUSTOM_RELATION_NAME VARCHAR2(50) NOT NULL, RELATION_SEQUENCE INTEGER NOT NULL ); The CUSTOM_RELATION_ID is just a unique ID for ...

78. Complex queries (tough one :)))))    forum.hibernate.org

So, dunno really how to begin... there is this call-center, people (Customer) calling in and ordering something (ServiceTask). Call center agents (User) taking their calls. Customers are grouped by regions (SalesorganisationCustomerData) where one customer can belong to more than one region ((List) Customer.salesorganisationCustomerData). Users have rights ((List) User.roles). ServiceTask has reference to User who created it and Customer to whom it ...

79. Error with complex mapping containing object w/ simple mappi    forum.hibernate.org

Newbie Joined: Tue Sep 30, 2003 7:10 pm Posts: 10 I'm refining down the trouble I mentioned in another thread. The first mapping below works fine. The second mapping fails. Note the only different is that "ValueObject" has a simple map added to it. Can anyone explain why this fails? Quote: Schema text failed: Problem trying to set property type by ...

80. Mapping a complex tree-like Database Model    forum.hibernate.org

Hi Folks, I'm currently using Hibernate for a simple homegrown application and it works fine. As a Hibernate beginner I'm don't know who powerful really hibernate is. The problem is: We have a very generative table model representing a graph mapped into relational tables. (It is not designed by me, I'm the poor person that have to implemend Java access methods.) ...

81. How can I perform complex post-flush operations?    forum.hibernate.org

I am using Hibernate in a complex system. Often I need to perform further work on entities after they are created or saved. Here is an example: There is a User entity, and an Audience entity, and a UserAudienceAssociation entity that is the relationship between the two. When a User is created, it is necessary to create UserAudienceAssociations. Similarly, changing or ...

82. Need help on complex Subquery with Aggregate functions    forum.hibernate.org

select e.certSerNbr, e.psdVendId, e.psdModId, e.psdSerNbr, e.dupErrCode, e.postgType, e.mailType, e.POSTAGE, e.COUNT, first.orgnScanFclt, e.MINTIME, recent.orgnScanFclt, e.MAXTIME from (select es.certSerNbr, es.psdVendId, es.psdModId, es.psdSerNbr, es.postgType, es.mailType, count(es.mailpieceId) as COUNT, es.postVal as POSTAGE, min(es.orgnScanTime) as MINTIME, max(es.orgnScanTime) as MAXTIME from ExceptionSum es where es.dupErrCode = 'D' and es.dupErrCode not like '%O%' group by es.certSerNbr, es.psdVendId, es.psdModId, es.psdSerNbr, es.postgType, es.postgVal, es.mailType) e, ExceptionSum first, ExceptionSum recent where ...

83. Please Help! "The statement is too long or too complex&    forum.hibernate.org

Hi all, I am stuck with this one: Caused by: COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/SUN] SQL0101N The statement is too long or too complex. SQLSTATE=54001 at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java:270) at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java:207) at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(SQLExceptionGenerator.java:458) at COM.ibm.db2.jdbc.app.DB2PreparedStatement.execute2(DB2PreparedStatement.java:2110) at COM.ibm.db2.jdbc.app.DB2PreparedStatement.executeQuery(DB2PreparedStatement.java:1596) at com.mchange.v2.c3p0.impl.C3P0PreparedStatement.executeQuery(C3P0PreparedStatement.java:188) at com.mchange.v2.c3p0.impl.C3P0PooledConnection$2.executeQuery(C3P0PooledConnection.java:473) at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:83) at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:631) at net.sf.hibernate.loader.Loader.doResultSet(Loader.java:166) at net.sf.hibernate.loader.Loader.doFind(Loader.java:111) at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:663) at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:678) at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:57) at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:49) at net.sf.hibernate.persister.NormalizedEntityPersister.load(NormalizedEntityPersister.java:415) ... 14 more Exception in thread ...

84. Complex object not being saved properly in an EJB system    forum.hibernate.org

Here is the scenerio. 1. A standalone client program loads a list of DistributionPlan objects. This is accomplished by calling a SSB which creates a new Hibernate Session object which is used to create a Query which then returns the list of object via the list() method. 2. The client program then presents a DistributionObject to the user for manipulation. When ...

85. How to save a complex object    forum.hibernate.org

I'm using struts and so, trying to implement your solution, I've got the desired object back from the session (using inbuilt functionality), altered it to my requirements and then tried to pass it back to the save method. All works well until it finds an 'old' version of the object already in the session (I assume from when I got the ...

86. previousState Null during Complex Validations    forum.hibernate.org

hiebrnate has a strange behaviour in cascade collections saving new entities. situation: entity E has a cascade=all collection of F's. after loading E, adding a new F into it's collection and updating E, hibernate calls onFlushDirty on the freshly created F instance, and later on calls an onSave, too. in the onFlushDirty call the previous state is null. i've not seen ...

87. Complex mapping question    forum.hibernate.org

Greetings, I have a fairly complex mapping problem. I have one solution for it but it is not as elegant as I would like. Hopefully someone on here has run into a similar problem and found a cleaner solution. Having said that, I have four tables that are linked together with foreign keys, etc. Parent ------------- id:long (other junk) MetaFields ---------------- ...

88. HELP-Transform a complex sql query into HQL    forum.hibernate.org

89. complex query    forum.hibernate.org

Hello im making a complex query(at least for me),and the results are not what i'm expecting. The thing is very simple ,date before and date after,when the date after is null ,i have to verified that the parameter is bigger than date before else check that the parameter is smaller than date after. The query is the following. losSuplementos = BossDB.find("from ...

90. complex query    forum.hibernate.org

Hi all, I am having trouble to get this query to work, and wondering if you all more experienced hibernate users can shed some light on this. Let's say I have a class that holds, say, cvs files and their versions: public class CvsFile { private String fileName; private int version; ... } How do you write a query to return ...

91. Extremely Complex Object Chart    forum.hibernate.org

I would like to thank anyone who helps in advance. I have a webapp (think tomcat,jsp,jdbc, etc.), which I think could benefit from hibernate. It has not yet been deployed and the database backend can be changed to the object-per-table. The only problem I am having is that the object model for the data is extremely complex. For instance, I have ...

93. Modeling Complex State...    forum.hibernate.org

There's two ways to look at this. #1 is that an Item class has a reference to a Rejection class because the item itself is "rejectable". In this case, just map the Item class with a reference to the Rejection class. #2 is that an Item and a "RejectedItem" are conceived differently. Here an Item does *not* have a reference to ...

94. more complex substitutions possible?    forum.hibernate.org

In hibernate 2 I want to have it send: {call nextval('foo')} instead of select nextval('foo) The susbstitutions setting seems to do simple things, but I would need something more complex. Or change the dialect, which looks like a source code change? Before you ask, I need this for clustering (so this command will get propogated out to all servers as a ...

95. Hibernate and complex oracle SQL queries    forum.hibernate.org

Hi all I would like to do the following oracle sql query with hibernate by using session.createSQLQuery but I don't know how... SELECT fabId, produitId, SUM(total) AS total FROM ( SELECT p.fab_id AS fabId, p.produit_id AS produitId, SUM(p.penalite_Valeur) AS total FROM PFT_PENALITE p GROUP BY p.fab_id, p.produit_id UNION SELECT f.fab_id AS fabId, f.produit_id AS produitId, SUM(f.fiche_Penalite) FROM PFT_FICHE f WHERE f.fiche_penalite ...

96. Complex sql Update/delete/insert    forum.hibernate.org

Hi There, Is there a way to issue a sql update with certain where clause via Hibernate? For example, I have a table with two columns: key int, value int. I want to be able to update the row to the effect that's similar to the following sql statement: update table tableName set value= (select value + 1 from tableName where ...

97. using complex sql query with createSQLQuery()----please help    forum.hibernate.org

hi yesterday i posted a message to know whether sub query can be written inside aggregate function.the answer was no. Now i am trying to write the following query with createSQLQuery(). but it is giving a invalid character exception. the equivalent of the following query is running in Oracle console. please tell me whether the query syntax is correct or not. ...

98. Complex Subtyped Relationship table    forum.hibernate.org

Hibernate version: 2.1.6 Mapping documents: Well that's what I'm trying to create. I have some legacy data which has a many-to-many table which is too complex for my understanding of hibernate. The table is: CREATE TABLE matrixLink ( id int(11) NOT NULL auto_increment, sourceCode char(1) default NULL, sourceId int(11) default NULL, sourceField varchar(40) default NULL, destinationCode char(1) default NULL, destinationId int(11) ...

99. Complex mapping with linking tables    forum.hibernate.org

Hi. I have a pretty complex problem and i'm not sure how to map it. I have a standard tomcat User & UserRoles tables setup. I also have what's going to be an event/class scheduler with the tables Event & EventInstructor the schema looks like this: Code: ---------- ---------------- | User ...

100. Complex SQL query in Hibernate    forum.hibernate.org

Hibernate version: 2.1.4 Hibernate's native SQL query support doesn't seem to be supporting "native" sqls. It requires me to specify "hibernate" syntax inside my native query. Can't I just pass a native sql like: "SELECT a.col1, a.col2, b.col3, c.col4 from table1 a, table2 b, table3 c where a....= b.... and b.... = c.... group by ... order by ..." to hibernate ...