object « Database « JPA Q&A





1. Do you think of the database or objects first when building applications?    stackoverflow.com

When you think about building an application, say for the web, and it uses a relational database, do you think about the database first and then putting you app as a ...

2. Hibernate: Check if object exists/changed    stackoverflow.com

Assuming I have an object Person with

long id
String firstName
String lastName
String address
Then I'm generating a Person-object somewhere in my application. Now I'd like to check if the person exists in the database ...

3. Can the usual ORM solutions interact with OO databases?    stackoverflow.com

For example, can Hibernate handle CouchDb? What about support for other OO databases in other ORM solutions? One of the (not that important) benefits of an ORM solution is the possible ability to ...

4. Defining database independant JPA object uid    stackoverflow.com

It turns out that the following example works when using mysql 5.x, however it doesnt when using an oracle 10g database. Is there a way to define a unique identifier field that ...

5. Howto get a random object from DB?    stackoverflow.com

For more dynamism, I would like to add a random part on my app. Here is what I would have done in other techs, and what is not working in play ...

6. Hibernate(newbie) - generating relational database from Object model    coderanch.com

Hi, Say if we have an object model designed with 500+ classes which we want to persist to a relational database using hibernate, is there any standard way to do this? It might be easier to map each class to a separate table but from the database point of view I assume this would be a big performance hit. So the ...

7. Object filtering in Hibernate from Database    coderanch.com

Hi, Ok let me explain the problem. I have a database table called "Person" with following fields ID,NAME,AGE and SEX. Now I have corresponding JAVA Bean called Person.java with all above listed column names as attributes. Now instead of writing a HQL for filtering data from database as List result = session.createQuery("from Person where ID>56").list(); for retrieving data of Person having ...

8. Hibernate is returning proxy objects even if no matching row is found on the database    coderanch.com

Hi guys, I have an issue with Hibernate and I don't know for sure if it is me doing something wrong or this is a bug / "feature". Maybe someone has stepped into the same problem and there is a way out. Supposing I have a table 'Persons' with the normal structure: ID, first_name and last_name, and the following records: ID ...





10.  is not executed    forum.hibernate.org

11. Check if object has changed in the database    forum.hibernate.org

12. Create Functions with database-object/create    forum.hibernate.org

Hi, I have a function in Oracle 10g and I want to use the standard way to create it within the hibernate mapping files with the help of auxiliary database-object. I have a function which works correct und is compiled out from the PL/SQL-Developer or other SQL-Tools. In the past I have experienced that e.g. create viewstatements must finish with the ...

13. Distributed database: object identification strategy    forum.hibernate.org

Hi, everyone. I need to develop an application which uses distributed data sources and synchronizes data between then. Each data source is unique identified by an integer number. All data sources contain similar data but data schemes could slightly differ. For example, there are two kinds of data sources: a newly developed application database and legacy database. I'm going to develop ...

14. help - object not written in to database    forum.hibernate.org

Beginner Joined: Wed Sep 24, 2003 11:16 am Posts: 20 Location: Turkey hi people, i need help using hibernate. it's rather a newbie question. i'm using postgresql 7.3.2 on linux with jdk1.4.2 and org.postgresql.Driver class. i'm trying to insert a simple object with no associations, one assigned pk of type Long. although i see correct insert sql stmt in hibernate logs, ...

15. Object cannot be flushed into database,here is debug info    forum.hibernate.org

10:26:39,484 DEBUG EntityPersister:617 - Updating entity: webmail.po.system.GroupData#20 10:26:39,484 DEBUG BatcherImpl:166 - about to open: 0 open PreparedStatements, 0 open ResultSets 10:26:39,484 DEBUG SessionFactoryImpl:526 - prepared statement get: update sys_groups set DESCRIPTION=?, GROUP_NAME=?, QUOTA=?, GROUP_FEE=?, MEGA_FEE=? where GROUP_ID=? 10:26:39,484 DEBUG SessionFactoryImpl:536 - preparing statement 10:26:39,500 DEBUG EntityPersister:366 - Dehydrating entity: webmail.po.system.GroupData#20 10:26:39,500 DEBUG StringType:44 - binding 'test' to parameter: 1 10:26:39,500 DEBUG ...





17. Object graph on several databases    forum.hibernate.org

Hi, I actually use Hibernate 1.2.5 The data I have to exploit in hibernate powered applications are set on several databases. eg (with manytoone associations): GrantClass ===>user===> UserClass ReportClass ===>user===>UserClass GrantClass is mapped on tbl_grants on database A UserClass is mapped on tbl_users on database A ReportClass is mapped on tbl_reports on database B Actually, to solve this kind of graph ...

18. reattaching objects. Can I avoid database access ?    forum.hibernate.org

Excelent. Thank you for the valuable tip. But now I'm getting another annoying problem. I constructed my Bean with a lazzy contructor for one collection, like: Code: Set getUniversities() { if (universities==null) universities = new HashSet(); return universities } But I found that there is a check in the lock command that ...

19. Pushing objects between databases    forum.hibernate.org

Lets say i have obj1 with a child object obj2. I also have hibernate running on one machine connected to a database, db1. I have another instance of hibernate running on another machine connected to a different database, db2. If i serialize obj1 and sent to the second machine via a webservice, how do i get the second instance to persist ...

20. object not reaching database    forum.hibernate.org

Beginner Joined: Mon May 02, 2005 6:17 pm Posts: 41 I have a problem persisting a simple object. Jugding by the console output it seems fine but no changes to db are being made. Here are the files hibernate.cfg.xml Code: ...

21. How to connect to multiple database objects    forum.hibernate.org

22. Which to build first? DB or Object Model    forum.hibernate.org

I am going to be building a new application and I am strongly thinking about using Hibernate in it. What is best practice and why, build the db first and maybe reverse engineer to objects in eclipse or build my POJOs and mappings and use either an ant task or something to generate my database schema based off the object model ...

23. Object Set Does Not Reflect actual Database State    forum.hibernate.org

We are using Hibernate 2.1 Our application receives xml files via web services that it then stores to our backend database using Hibernate. Each xml file translates into 10 - 20 backend database records that must be saved. These database records are all saved using the same Hibernate Session. An example of the problem we are running into is as follows: ...

26. java.lang.StackOverflowError when storing object in database    forum.hibernate.org

I have a complex hibernate mapping which maps objects with circular relations between objects and many cascading relation. An XML parsing is done to build the objects intantiations in memory. When this parsing is successfull, I ask to hibernate to store the root object which stores in cascade all other dependent objects. When storing objects in database, the java.lang.StackOverflowError is thrown. ...

27. Object Layer vs DB referential integrity    forum.hibernate.org

Hello, I have a question that may have been answered elsewhere on the forums (but if so, I couldn't find the proper keywords). Basically, I'm wondering what is the best way to enforce referential integrity using Hibernate. If I were doing pure POJOs, I might enforce referential integrity programatically. So, for example, if I had a many-to-many bidirectional association between a ...

28. Problem in retrieving an object from DB    forum.hibernate.org

I have a object of Claim class which contains object of Response class and Response class object contains a list of Amount class. Now when i retrieve the claim object based on claim id with uniqueResult() function then i got duplicate records/objects of Amount class list. But when i try to retrieve same Response object which is associated with same claim ...

29. Synchronizing from database to object    forum.hibernate.org

I know that hibernate can do presistence the object to database. However, can hibernate handle the synchronization from database to object? That means if there is some changes in database (the changes are done through some other ways), can hibernate know there is some changes in the database and hibernate can be notified for these changes?

30. navigating a multi-database object graph    forum.hibernate.org

Good day! I'm hoping for an out-of-the-box solution to navigating an object graph that is persisted across several databases. The software under development is using Hibernate to map to legacy databases where relationships span multiple databases (six in this case). I'm trying to provide a general access solution to higher tiers by making the objects navigable in as natural a way ...

31. large objects + postgresql    forum.hibernate.org

32. Relational Database to Objects    forum.hibernate.org

Hi All, In all the tutorials I have looked for Hibernate i have only learnt about object mapped to Relational database. Is it possible to use Hibernate for relational to object mapping. I mean for converting the data from relational databse to objects. And if yes, Could someone please direct me to some of such resources. Thanks in anticipation.

33. Auxiliary Database Object Custom Class' sqlDropString    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 3.2.2 Name and version of the database you are using: MySQL 5.0 I am attempting to execute a custom class implementation of an Auxiliary Database Object which first drops a foreign key constraint, then re-adds it w/ON DELETE CASCADE specified. Pretty simple . . . however, after implementing the ...

34. defining trigger with database-object    forum.hibernate.org

Hi, I am having difficulties adding a trigger via the Code: tag. As stated in the hibernate documentation, chapter 5.7 (http://www.hibernate.org/hib_docs/reference/en/html/mapping.html) I try to add a trigger to the database with the following code: Code: CREATE OR REPLACE FUNCTION example_function() RETURNS trigger AS $null$ ...

35. defining trigger with database-object    forum.hibernate.org

Hi, I am having difficulties adding a trigger via the Code: tag. As stated in the hibernate documentation, chapter 5.7 (http://www.hibernate.org/hib_docs/reference/en/html/mapping.html) I try to add a trigger to the database with the following code: Code: CREATE OR REPLACE FUNCTION example_function() RETURNS trigger AS $null$ ...

36. Force hibernate to get objects from DB    forum.hibernate.org

Your second-level cache might be enabled. In that case, your objet is being retrieved from memory or some disk directory, in order to save trips to the database. That is not necessarily a bad thing. If you are still in doubt, make a query on that ID. The query.list() method is guaranteed to return always fresh data. But asking "how to ...

37. [Beginner] Howtoput my objects in a database    forum.hibernate.org

I have a "database design" problem. I want to store article and keywords to this articles. This is a "n to m" relationship. I thought I can do this by putting the articles in a table, the keywords in a second and the realtionship information in a third. T_Article: ID | Name | Author | ... T_Keyword: ID | Keyword | ...

39. object graph spread accross database    forum.hibernate.org

Hi All, I have two tables namely Person and Dept with many to many relationship between them. Then its obvious that i have access each table from others mapping file.eg. I have to access Person table from Dept.hbm.xml and vice versa. Now if my two table are are on different databse. I have to create 2 hibernate configuration files. one with ...

40. object graph spread accross database    forum.hibernate.org

I have 2 tables namely Person and Dept with many to many relationship between them. Then its obvious that I have refer each table from others mapping file. e.g. I have to refer Person table from Dept.hbm.xml and vice a versa. Now my these two table lie on different database. For this purpose I have v created 2 hibernate.cfg.xml. One having ...

41. Cannot upload file to postgres (Large Objects...)    forum.hibernate.org

org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not insert: [model.File]; uncategorized SQLException for SQL [insert into file (created, description, file, modified, project_id, id) values (?, ?, ?, ?, ?, ?)]; SQL state [25P01]; error code [0]; Large Objects may not be used in auto-commit mode.; nested exception is org.postgresql.util.PSQLException: Large Objects may not be used in auto-commit mode. org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83) ...

42. Checking if a duplicate Object already exists in the db    forum.hibernate.org

Hibernate version: 3.2.3.ga Hi, I have a question about assigning IDs when persisting a nested object. I have read the sample chapter and have been through a couple of books but cant find anything enlightening to what must be a very common scenario. I have 2 tables: ARTICLE ID ... TAG_ID TAG ID WORD My Article POJO has-a Tag object. When ...

43. Removal from object structure WITHOUT removal from database?    forum.hibernate.org

Newbie Joined: Sat Mar 21, 2009 11:44 pm Posts: 3 Hi, I am using BioJava to read protein files into a SQL Server database. Basically, the database and object structure is as follows: A protein file can have many (read hundreds of) 'model-chain-residue's , and a model-chain-residue can have many (read dozens to hundreds of) atoms. I have the database structure ...

44. getting object values from a database    forum.hibernate.org

Hello - I need an id from a table as a object type - I see in a lot of tutorials that you can cast the Object query, but I just get that an integer cannot be cas to TOperands: public TOperands getTOperands(){ TOperands newOp= new TOperands(); Object query=null; try { org.hibernate.Transaction tx = session.beginTransaction(); Query q=session.createQuery("select id from TOperands where ...