database 4 « Database « JPA Q&A





1. Getting createdDate from Database    forum.hibernate.org

We are trying to do the same thing - simply use the database (SQL Server 2000 in our case) function getdate() for create and update timestamps (as opposed to the app server generating the datestamps). I would have guessed that the implementation of the mapping insert=false update=false generated=insert/always would have simply used the native database getdate() function based on the generated ...

2. Can hibernate be used to create new database ?    forum.hibernate.org

Hi, I have a project of an application that should deliver hosting like services for its client web applications. Each web application will run on the java ee application server and have a separate database connection. The main application will have some registered jdbc connections. If a new user would like to register the application should use the stored connections to ...

3. role for database access?    forum.hibernate.org

4. Using Hibernate for database independence    forum.hibernate.org

Hello, I have a rather quick question on the topic of "Can Hibernate do this?" I want to use Hibernate mainly for database independence for all projects with some ORM for some of our newer projects. The only problem I come across is not being able to do "left joins" without creating associations (we receive the "Path expected for join!" error). ...

5. Problem with access to database    forum.hibernate.org

Hello everyone, I'm writing my first big webapplication using spring and hibernate, and I have problem. Let's consider this situation: I have two tables joined with third one (many to many relation), with hibernate mappings: students: Code: - studentId - firstName ... and other personal data studentsInClass: Code: - classId ... and other data After all I have two classes: Student ...

6. Database synchronisation    forum.hibernate.org

Hello, I am wondering if it is possible to achieve a thing like this "natively" with Hibernate. Let's say that I create a new project, create a database schema classes with Hibernate, and then run script "sync_database" that creates all the tables in the database. That is doable as I have seen in the docs. But, the next step. Then, I ...

7. Create/drop database    forum.hibernate.org

Good evening, I would like to know if it is possibly to create/delete/edit the architecture of a database with Hibernate. I have found how to do this with the tables but the database must already exist. Is there any way to create a new database and give an user and a password through Hibernate? Kindest regards mjb

8. Database changes not being detected    forum.hibernate.org

I have a database that is being acted on by several "agents". The user interface is a fairly simple web application. My problem is that changes made by other processes are not reflected in the web application. That is to say, any changes made to the database after the webapp is initialized fail to appear on it. Initially I thought it ...





10. Automatic database creation    forum.hibernate.org

11. database creation    forum.hibernate.org

12. database creation    forum.hibernate.org

Hibernate tools can help you do that. You can invoke hbm2ddl hibernate tool at runtime and do a schema export. But doing that in runtime, I don't know how safe it is. You should read the hibernate tools guide for further details. If you have further queries on hibernate tools, you should post it on the tools forum

13. Extracting the 20 best students from the DB    forum.hibernate.org

14. Two databases    forum.hibernate.org

Hello, I'm using two Mysql database with foreign key and constraints from one table to another : CREATE SCHEMA IF NOT EXISTS `client` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci ; CREATE SCHEMA IF NOT EXISTS `referencial` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci ; CREATE TABLE IF NOT EXISTS `referencial`.`NETWORK` ( `NETWORK_ID` VARCHAR(45) NULL , `NETWORK_NAME` VARCHAR(45) NULL , PRIMARY KEY (`NETWORK_ID`) ...

15. one database, two hibernates    forum.hibernate.org

It depends on how your entities are defined. I assume you use JPA because you talk about app severs? Well, if your entities use the @Version annotation, or the hbm equivalent, then regardless of who concurrently accesses the database (2 apps, 2 modules, 2 threads), only one of them will be able to update the entity, and the other will throw ...

16. Hibernate with purely relational database    forum.hibernate.org

Hello, I have been told that Hibernate as an ORM can function very well as an abstraction layer between Java and a purely relational Oracle Database. The intent here is that Java will be able to work internally with the objects defined as they desire, while the database is designed in a purely relational manner (in order to provide internal efficiency, ...





17. Hibernate Statistics suitable for benchmarking DB upgrade?    forum.hibernate.org

Hi All, I am responsible for maintaining a small application (a collection of jobs) which is used to publish data from our internal database to an external web application. Next month, my company is planning to upgrade this database from Oracle 9i to 10g, and asked me to perform some benchmarking to verify that no performance issues arise as a result ...

18. Why not store feedback database ?    forum.hibernate.org

Hi ! I'm using Oracle 10, Hibernate3.0 and IDE NetBeans. When I run my applycation, I'm insert into Database Table some records. And I turn on SQL Navigator to show my data in my datatable(when my app runtime), I saw them(my records above). But, when I closed NetBeans IDE and Show my data again(In SQL Navigator) then my data was loose ...

19. programmatically asking Hibernate to recreate the database s    forum.hibernate.org

public static void main(String args[]) { AnnotationConfiguration config = new AnnotationConfiguration(); config.addAnnotatedClass(User.class); config.configure(); new SchemaExport(config).create(true, true); }

20. Problems when DB is down    forum.hibernate.org

Hi, I've encountered a problem which I can't seem to resolve or find the source of it... My version of hibernate: 3.2. I'm using the C3P0 connection pool (hbm config file attached). When I create a session factory with my hibernate.cfg.xml config file and the DB (mysql Ver 14.12 Distrib 5.0.45, for Win32) is up and running, all works fine. But, ...

21. Create new database using hibernate    forum.hibernate.org

package com.examscam.model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import org.hibernate.cfg.AnnotationConfiguration; import org.hibernate.tool.hbm2ddl.SchemaExport; @Entity public class User { private Long id; private String password; @Id @GeneratedValue public Long getId() { return id; } public void setId(Long id) { this.id = ...

22. Reverse Engineering a timeseries database    forum.hibernate.org

Hi, I am working with a legacy database of time series and am trying to develop a java application on top of it. Since I am new to hibernate, I am having trouble figuring out the mapping of the time series. A simplified version of the tables of interest are as shown below (click on the thumbnail for a larger view): ...

23. Two ore more database connectors in a single WAR    forum.hibernate.org

We have a product used by two customers. One of them is using MySQL and the other is using SQL Server. We deliver them a all included war file for each new version of our application. At the moment we need to build 2 wars. One for each database type. The only different in both is the xml description of the ...

24. Hibernate for Multiple Databases    forum.hibernate.org

Hi All, I am newbie to hibernate, My question is .. Using hibernate can we execute a SQL query which is across multiple database? (as far as I know one session/transaction you can get it from only one sessionfactory and sessionfactory is bind to particular database connection but just curious if it can be done in some way using HQL) For ...

25. Bulkifying database operations    forum.hibernate.org

Hello. In an application I'm developing right now there are two very costly synchronization operation, one in which a lot of objects are created, and one in which a lot of objects are deleted. We are talking about thousands of sql insert and delete statements in each. Due to some performace commitments, these must be optimized. What I would like to ...

27. Hibernate such that changes don't propagate to DB    forum.hibernate.org

Hibernate version: 3.2 Name and version of the database you are using: DB2 I am coding what was supposed to be a fairly simple UI for administering some data... and then internal politics reared its ugly head and made things interesting. Management now does not want the tool to make changes to production directly. Instead, they want to point it at ...

28. Project with java classes and database already created    forum.hibernate.org

Hello everybody, I am thinking about using Hibernate tools for my project. I have been reading tutorials about hibernate, but I only find those which tackle code generation (application driven) or database generation (database-driven) problems. In my case the java code and the database are already defined. The idea is that the java code simulate the execution of a UML statechart ...

29. Multiple Database Configuration with HibernateDaoSupport    forum.hibernate.org

Hi All, I have an existing application with one database and all the DAOs extends HibernateDaoSupport. So, all the operations are via getHibernateTemplate(). However, I now want to introduce another database to the application. I understand the configuration part of have multiple datasources and then having multiple beans for org.springframework.orm.hibernate3.LocalSessionFactoryBean. Now, I am struggling to understand that when I invoke getHibernateTemplate() ...

30. Reverse engineering database problem    forum.hibernate.org

31. A request with 3 database! It is possible?    forum.hibernate.org

Hello Dear friends I have a project with hibernate spring The company work with 3 database in SQL server and it is an application that communicates with these 3 database as a request may involve several table these 3 database. Does hibernate can make a connection with the 3 database SQL server and run a query that makes use of tables ...

32. Monitoring the database from two programs    forum.hibernate.org

Hibernate version: 3 Situation: I have a program, which manage objects using Hibernate. This program has to know every changed made to the data of this objects. I also have a second program changing the data of some of the objects from the first program. This program also using Hibernate. Problem: My problem is to let the first program know that ...

33. hibernate databases    forum.hibernate.org

35. DB-side domains support    forum.hibernate.org

Does Hibernate support database-side domains AKA user-defined datatypes ? I do not mean user-defined datatypes which can be created in some databases like extensions to the basic datatype set. (e.g. in PostgreSQL). I mean datatypes which are actually synonims or aliases for standard DBMS's datatypes with some predefined arguments and crated with something like CREATE TYPE MYID numeric(10); The supposed implementation ...

36. openSUSE 10.3: Program hangs durin hibernate database access    forum.hibernate.org

Hi, I use hibernate for accessing a mySQL-DB. On my system (openSUSE 10.3) the program sometimes hangs during the db access via hibernate. It just happens on my system. On other systems it works very well. What can be the problem? The same mySQL- and hibernate-Version is installed on all systems. I don't want to reinstall my whole system so I ...

37. Supported Databases    forum.hibernate.org

38. Recomended DB?    forum.hibernate.org

Hi @all, we are going to migrate our Client/Server Application from C++ to Java (which then will be running in an browser), which will storing data on- and offline. Currently we are using Sybase anyhwere 9 as a DB. We are planing to use Hibernate and since Hibernate does not support Sybase Anywhere 9 (and since we would like to minimize ...

39. Spotting DB changes    forum.hibernate.org

I confess to being a bit of a newbie but need help on something that I can't get my head around. I am developing an ajax web application (but perhaps that's not so relevant) and once a collection of objects has been loaded from the DB I display the records in a table. How can I force the table to be ...

40. Multiple Database support from Hibernate    forum.hibernate.org

41. Multiple Database support from Hibernate    forum.hibernate.org

42. What can cause this behaviour? Duplicates in the database    forum.hibernate.org

As you mentioned , equal and hashCode method are already there, so i think you are using java.util.list for relation B-->C. you you want to avoid duplicate, you java.util.Set for relation B-->C. For Hibernate, two objects (of same entity) are same only if they have same identifier value (primary key). so if there are two Object of Type C, and all ...

43. How to store whole image to database (not just a path) ????    forum.hibernate.org

Thank you for answering. I was trying to save file as blob earlier, but I use a4j:mediaOutput to generate images dynamically from database and when calling paint method I was getting something like "bytes cannot be get from blob outside of transaction" (I don't remember exactly). Anyway, even if there would be no exception mediaOutput cannot display large data as data ...

44. Getting tablelist of a database.    forum.hibernate.org

45. How to use multiple databases within one web application    forum.hibernate.org

I have to take backup of system logging and tracing and any modifications made by the user. I am using one database to so this, that is becoming huge now. I want to use a separate database for all the backup related issues to avoid table clutter. I am using spring framework with hibernate support. Can any one suggest me, how ...

46. having a problem in updatingmysql database    forum.hibernate.org

Hi all, I am using following code, but evry time i try to use it, I get the error " Communications link failure". Can anybody help?? Connection con = null; Statement stmt = null; ResultSet rs = null; try { Class.forName("com.mysql.jdbc.Driver"); log.info("Creating connection with the database"); ///////it doesn't go to the next log statement///////// con =DriverManager.getConnection ("jdbc:mysql://192.168.1.10:3306/project2","", ""); log.info("connection made"); stmt ...

47. Tips for database portability    forum.hibernate.org

I'm working on a new project that uses Hibernate and I was wondering if anyone had any suggestions for "best practices" when it comes to being able to port a project between database systems? My big concern right now is with column size limits between different databases (e.g. MySQL vs MS SQL Server vs Derby vs Oracle), and other gotchas that ...

48. hibernate and working with multiple databases    forum.hibernate.org

I prototype a simple hobby web application where a user can create many companies but each company will have it's own database schema So a user may choose to work on company X and another user can choose at login time to work on company Y Number of companies are dynamic since anytime a new company may be created. So each ...

49. Multiple DataBase in Hibernate.    forum.hibernate.org

50. Database changes are ont reflecting    forum.hibernate.org

Hi, I am inserting some data into database using struts2 nad hibernate , but data is not reflecting in the front end util i restart the server . here is my hibernate.cgf.xml file : true UTF-8 com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/ghschananwal?zeroDateTimeBehavior=convertToNull root password org.hibernate.dialect.MySQLDialect

51. reducing database roundtrips    forum.hibernate.org

There's no simple way to optimize this that won't overly complicate your mapping. You could issue HQL I guess? Remember, this all happens inside one, single transaction, so you may have extra SQL, but not extra transactions, which is what you'd get if you just did it all by hand. It's actually fairly efficient. I think your bottlenecks will be in ...

53. speed looking up database    forum.hibernate.org

We are experiencing some slow connections with hibernate. Right whenever we call a service, it seems to pause about 5 seconds before making the connection and searching. Here is the code we are making on the first call: Code: public AbstractUser login(String username, String password){ //Configuration cfg = new Configuration().addResource("hibernate.cfg.xml"); ...

54. Tell Database to use UTF8    forum.hibernate.org

Hello How can I tell the Database to use UTF8 in its Tables? This is the command i am executing on mysql at the moment: ALTER TABLE `mydb`.`mytbl` ENGINE = InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci; where and how can i define this in the hibernate config or or mapping? Thnax for the help! Cheers B Tietjens

55. how the hibernate reducing the hit rate to database    forum.hibernate.org

Well, for one, Hibernate chaches data until a transaction is comitted, so if a database row is requested multiple times, there won't be multiple hits, due to the cache. Hibernate uses transaction isolation levels to sync to the database. If you're getting started with Hibernate, please check out my tutorials through my signature links. You'll really enjoy working with Hibernate!

56. Accessing database through hibernate    forums.oracle.com