database « Data Type « JPA Q&A





1. Hibernate case-insensitive utf-8/unicode collation that works on multiple DBMS    stackoverflow.com

I'm looking for Hibernate annotation or .hbm.xml that allows me to specify a table column as case-insensitive string working in unicode/utf-8/locale-independent manner that works on multiple database engines. Is there any such ...

2. What is the best way to handle validity dates in applications?    stackoverflow.com

How do we model these objects ? Scenario 1: Price changes in a time period

EffectiveDate  ExpiryDate    Price
2009-01-01     2009-01-31    800$
2009-02-01   ...

3. Hibernate DateCreated, DateModified columns from DB not VM(App)    stackoverflow.com

Using Hibernate 3.5.1 and MSSQL 2008 Hi trying to implement the typical DateCreated and DateModified columns. The issue I have is that the time must be set from the DB not the ...

4. org.hibernate.PropertyAccessException - How to get a null value out of database?    stackoverflow.com

Here is the exception: org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of com.FOO.hibernate.Tccl.MIN. I found that this exception happen when i try to get the null value from ...

5. How can we store data in two different database at a time using hibernate?    stackoverflow.com

Interviewer questions to me: How can we store data in two different database at a time using hibernate ?? Advance thanks for reply...

6. How do i use db sys date in hibernate    stackoverflow.com

I saw an example where people have suggested to use the below

<property name="lastActivityDate" type="timestamp" >        
    <column name="C2810_LAST_ACTIVITY_DATE" />
  ...

7. Hibernate wont write correctly floating point numbers to a MS SQL 2005 database    stackoverflow.com

Here is the case, I have a java double property mapped to a ms sql server decimal(18,3), it was float before I changed it to decimal but the outcome is the ...

8. Use of empty strings instead of null - a good practice?    stackoverflow.com

Consider for example in the database:

CREATE TABLE users (
  id INTEGER IDENTITY PRIMARY KEY,
  last_name VARCHAR (50) DEFAULT '' NOT NULL,
  first_name VARCHAR (50) DEFAULT '' NOT NULL,
 ...

9. Hibernate should hit db every single time    coderanch.com

Hi, My application has web services component which updates the database. I am using Hibernate 2.1 to retrieve the data from the database. The sequence of event is like this. 1) Retrieve a record from a table using Hibernate. 2) Using web service the record is updated. 3) The application performs the query again. The stale value is returned by the ...





10. org.hibernate. HibernateException: database product name cannot be null    coderanch.com

hi, i am building a small project, learning hibernate, so i have my class People.java, which maps the People table in the database, I also have TestHibernate1.java, which does the main work, and I have my 2 configuration files, in the same folder as the 2 previous java files, hibernate.properties and People.hbm.xml so I added all the needed libraries and I ...

11. org.hibernate. HibernateException: database product name cannot be null    coderanch.com

Hi, im getting this error in my code: Initial Session Factory creation failed org.hibernate.HibernateException: database product name cannot be null org. hibernate.HibernateException: database product name cannot be null at org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:57) an so fourth... The line which produces that exception is here: Configuration forAlias = configurationForAlias(); //works fine Session session = forAlias.buildSessionFactory().openSession();//throws exception I've tried the following but they do not help: ...

13. Having Diffyerent data types in the DB and DTO in Hibernate    coderanch.com

Hello, in my database, i m storing a date property as a Date object and in my DTO i m storing the property as an instance field of type Date. but in my getDate method i m returning a long ( date.getTime()). and i keep getting a classCastException when testing this code. Is it possible to have the type in the ...

14. How to connect multiple databases at a time using Hibernate    coderanch.com

If you don't mine can i get complete code or related material. This is all standard DAO pattern and Hibernate stuff. It would appear that the problem is not the lack of code examples being provided to you. From the links provided, I think you have been given more than enough information to start building your own program. Try out some ...

15. Databases have views, JPA has nothing equivalent :/    java.net

Hi there, I was wondering: databases have 'views' which can be used for clients if they want only some piece of data from one table of if they wish to combine columns from few tables to operate on (reading or updating)... or just because clients does not have to be aware of how does database structure looks.

16. HQL returning null but values in the database    forum.hibernate.org

Newbie Joined: Mon Nov 02, 2009 11:29 am Posts: 1 I'm using Hibernate with JPA annotations and I will run a HQL query in debugger that wont return any results. The strange thing is that after I attempt to run the HQL query I immediately stop the debugger and plug the generated mysql code generated from HQL into a query browser ...





17. real-time replication of RAM db to FS based DB    forum.hibernate.org

What is the best way to ensure that a hibernate accessed/managed RAM db gets backed up in real time? I have a web app which uses a RAM db for performance reasons. Most tables are read-only and are loaded on app start-up. The read-write tables need to be replicated in real time to an FS db. I'm using hsql. Hsql's file ...

18. Legacy DB with Multifield Dates    forum.hibernate.org

I have a database whose dates and time are split across a number of fields. Such as: CENTURY, YEAR, MONTH, DAY, HOUR, MIN, SECOND (Where all fields are 2 digit) Being very new to hibernate I was wondering if anyone could suggest a nice way to deal with this. I am not concerned with performance at this time, just simplicity of ...

19. @TemporalType.DATE and SQLServer DB problem    forum.hibernate.org

Greetings! I am relatively new to java, and very new to hibernate, so hopefully this question will be easy to understand and provide a little help on. I have set up a table which contains a date field as part of a primary key. According to other documentation that I have read, this is the correct syntax: @Temporal(TemporalType.DATE) private Calendar TransactionDate; ...

20. Getting Null value while accessing the database view.    forum.hibernate.org

Hi all, Am new to hibernate environment.I need to access the data from database view, while trying to fetch the data from database view, am getting the null value. Also I execute the hibernate query in database separately and its work for me. Does anyone help me, how to access the database view data? Details : 1) hibernate 2.1 2) database ...

21. getting null when accessing database view through hql    forum.hibernate.org

Hi, I have view in oracle database and when I am trying to access the data using hql query form the view, I am getting null as the id item. When I access the id.column name then it is giving me the data. I have reverse engineered my view using eclipse jboss plugin and then it created me view java pojo ...

22. how to compare date of Oracle DB via Hibernate?    forum.hibernate.org

Dear All, Can anyone share his/her experience of how to compare date of Oracle DB thru Hibernate query statements? I always have the sql exceptiom ORA-01861, literal does not match format string. My query string just likes "select ... from ... where ... between '2004-01-01' and '2004-04-01'.... ". I use Hibernate 2.1.2 and Oracle 9i. any suggestions? Jun-Liang

23. Problem with Hibernate when storing Blob data to Oracle DB    forum.hibernate.org

Newbie Joined: Thu May 27, 2004 10:42 am Posts: 2 Hi, I have problems in storing blob data to Oracle through Hibernate. I followed the sample on http://www.hibernate.org/73.html. I am able to retrieve the data but not able to store the data. When I am trying to store the data, I get this exception Root cause of the problem is Root ...

24. db access number    forum.hibernate.org

Hi, I want to know how many real DB accesses in Hibernate Query. Say Object A has a collection of Object B (10 records) and set non-lazy initialization for collection B. When I retrieve one record A, the SQL generated will be 11, one for record A and 10 for record B. Does it mean that in this single HQL, hibernate ...

25. Legacy database where 0 means NULL    forum.hibernate.org

26. Date and Hour of database    forum.hibernate.org

28. intermittend NULL entries in database    forum.hibernate.org

Newbie Joined: Tue Apr 19, 2005 7:34 am Posts: 4 Hello, I do not have much experience with Hibernate and encountered a problem I could not find a solution anywhere. The unpelasent thing is that it is an intermittent problem. It keeps occurring in version 2.1.8 as well as in 3.0.1. I have two classes: WorkItem and WorkIssue. WorkItem has an ...

29. How to get current date/time from database    forum.hibernate.org

30. Null values coming from the database    forum.hibernate.org

31. Non-null in database, null in Java    forum.hibernate.org

I am helping to architect a new application that uses a somewhat legacy RDBMS (as well as some existing legacy databases). The current databases often use special values (generally zero or an empty string) to represent what would normally be considered a null to us Java folk. The DBA wishes to continue this practice for performance reasons as well. We are ...

33. HibernateException: database product name cannot be null    forum.hibernate.org

Hi, I'm trying to integrate hibernate to tapestry 4.0 (beta-11) and hivemind (1.1). i have hibernate.properties located in context/WEB-INF/classes the same place where all my classfiles for the webapp are also. it includes hibernate.connection.datasource java:comp/env/jdbc/mysql-t4 hibernate.dialect org.hibernate.dialect.MySQLDialect datasource mysql-t4 has been configured correctly in tomcat (5.5.12) and i can connect and query the database from jsps. but when i try to ...

34. database product name cannot be null    forum.hibernate.org

Hi Hibernate GURUS, I am getting the below Exception: Please help me to solve this... I am also pasting the Hibernate.properties file with this. Error: ------- Exception in thread "main" java.lang.RuntimeException: org.hibernate.HibernateException: database product name cannot be null at hiber.ConnectionFactory.(ConnectionFactory.java:84) desc = JDBC-providerdesc name = ORA Hibernate.properties ----------------------- hibernate.dialect = org.hibernate.dialect.Oracle9Dialect hibernate.connection.driver_class = oracle.jdbc.driver.OracleDriver hibernate.connection.url = jdbc:oracle:thin:@115.24..45.67:1524:TST1 hibernate.connection.username = comm_fr hibernate.connection.password ...

35. Problem retrieving BLOBs from Oracle database    forum.hibernate.org

Session session = null; try { session = longTermSessionFactory.getCurrentSession(); // Try to retrieve the Information Form Response. Query query = session.createQuery("FROM InformationFormResponse " + "WHERE id='" + id + "'"); InformationFormResponse response = (InformationFormResponse) query.uniqueResult(); ...

36. Getting null objects from database    forum.hibernate.org

Hello, I'm using Eclipse 3.1 and MyEclipse 4.1.1 to make a test application, and used the "wizard" to create the mappings and the databes configuration. The result of that process where a few classes: SF.java //Session Factory AbstractCustomer.java Customer.java // my table is called customer CustomerId.java and the configurations XML. I can open a session, and insert a row with data. ...

37. Is Hibernate truly db transparent when using blobs?    forum.hibernate.org

Hi! This question is raised after hearing rumours. I have not yet started trying this out by myself. Therefore, no source code, and no stacktrace is provided. Please correct me if I violate the forum etiquette! Background I have an application that uses Hibernate. It uses BLOBs a lot. I want it to be able to run with MySQL, SQLServer and ...

38. How to use hibernate to handle 2 databases at same time    forum.hibernate.org

I have a scenario lets say my application wants to use 2 databases MySQL & Oracle. I have x tables in MySQL & y in Oracle. How will i be able to create two sessionFactories in either applicationContext.xml or hibernate_cfg.hxl. will following snippet work

39. Reading values from database returns null objec    forum.hibernate.org

Hello Friends, I am a first time hibernate user. I imported data from a CSV file into an SQL Server 2000 table named 'MachineDetails'. i then used hibernate to read this table using the code given below. I found that it returns null objects and the size of the List returned is exactly same as the no. of rows in the ...

40. How do I match a text string against the db    forum.hibernate.org

I'm creating a search method where people enter the word they want to search for. This word must then be matched against the db. I've created a hql query, but it dosn't work (Caused by: unexpected token: against): Code: public List searchPictureByTags(String searchCriteria) throws NeSystemException { Session session = null; List result = null; ...

41. Real time reflect the changes of Database    forum.hibernate.org

Our project want to use Hibernate to connection the Database. However, there is one question I am not sure. Since our Database can be changed by others, does Hibernate have some way to reflect the changes in Database? That mean once there is some data be changed in Database, the mapping object can get this changes and can be handled by ...

42. Restarted the HQL DB while every time application starting    forum.hibernate.org

Hi Guys, i have one simple problem that is funny for you and also me. when i compiling the my simple application from Ecplise 3.1 IDE then every time i need to restart the HQL DB server that running on cmd prompt. i do requied to restart the HQL DB server bcos of each trasaction ,it is stoped. and calling System.exit(0) ...

43. how to force hibernate to read db every time to get lastest    forum.hibernate.org

hi all, I use hibernate 3.2 and db2 v8. I met a problem: I use hibernate to query records and there is another process also using the same db. sometimes I found that the other process changed db record, hibernate still give me the old data. it seems hibernate didn't read db, maybe read the memory. I don't use the second ...

44. Getting Null from database with hibernate    forum.hibernate.org

I have this comment field in the database and if it is empty in the database I get the value "null" in my commnets fields which i dont want... we tried checking for nulls in the jsp but it doesnt work... and the null value still appears on the jsp.... how do i fix this

45. Problem with date in an Oracle Database    forum.hibernate.org

46. how to compare STRING dates in Oracle DB via Hibernate?    forum.hibernate.org

Hi, can you please share any thoughts or guidelines regarding the following issue: I have a varchar column in Oracle 10g, which stores datetime values, this column is mapped as a string in my mapping file. I'm creating a simpe query using this column: ... Query query = hibernateSession.createQuery("from ELTLDetail as d where d.timeStamp >=?"); query.setString(0,"2007-04-17"); ... This code works perfectly ...

48. Poor response time when Larger number of records in DB    forum.hibernate.org

I'm using hibernate 3.2 JPA in my project and oracle db. we are facing poor response time(though only one record is fetched from the db) when there are large number of records in DB and user has to wait longer time to get the page in GUI. The issue has become very critical now. Response time was good initially in prod ...

49. Copy object from one database to another    forum.hibernate.org

I have two session objects, each for separate datasource (separate database). Those two databases hava the same schemas. All I want to do is to retrive the same object from one database and persist in another database as a new object. What should I do after I receive that object from first database. Setting object id to null is enough before ...

50. Valid Time Temporal Databases and Hibernate    forum.hibernate.org

Hibernate version: NHibernate 1.2.0.GA I am trying to figure out how to get NHibernate working with our valid time temporal database. The database is an Oracle database and every table is a valid time table, therefore every table needs a VALID_FROM and VALID_TO column in it. There is no data, other than the surrogate key, that doesn't need to be versioned. ...

51. Problem while getting the Current Timestamp from DB    forum.hibernate.org

Newbie Joined: Fri Dec 07, 2007 4:25 pm Posts: 6 HI all, I am new to hibernate. I am trying to get a system date from database (Oracle 10g) in the timestamp format. so in my hbm file i have used the query select SYSDATE from DUAL while in my DAO i m using the method to get ...

52. My DB stores dates as numerics...what to do when = 0?    forum.hibernate.org

Hibernate version: 3.1.3 In my database, date fields are often stored as seven-digit numeric fields, in the format CYYMMDD. I have created a UserType to map these numeric fields to a java.util.Date. My problem is this: in my NullSafeGet() method, the value retrieved from the DB for these numeric date fields will sometimes be "0". Since java.util.Date doesn't really offer a ...

53. Problem with Oracle BLOBs after db reconnect    forum.hibernate.org

Hi @ll, I have a serious problem with Hibernate. We are running through all entries in a specific table on an Oracle DB and read the contained BLOB fields. The application is running fine until the application has to reconnect to the database (network problems, etc...) ... after the reconnection we are not able to read the blobs anymore. All other ...

54. Can't read date from database    forum.hibernate.org

Hi all. I'm using hibernate with latest jboss realese (4,2). I got very strange error while using entity. I have few dates in my Entity: Code: @Basic @Temporal(TemporalType.TIMESTAMP) private Date purchaseDate; @Basic @Temporal(TemporalType.TIMESTAMP) private Date saleDate; @Basic ...

55. Increment database with time using hibernate Problem    forum.hibernate.org

Hi, I am making application using hibernate and i m stuck with a problem Problem: I need to give 30 credits points to all my customers after every 30 minutes whether they r logged in or not and other ppl can also see their incremented points can u please tell me how to increment the database of all the customers with ...

56. get still does not hit the database after first time    forum.hibernate.org

Expert Joined: Tue May 13, 2008 3:42 pm Posts: 919 Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com This little tutorial on the difference between load and get, and how the two work, might be helpful: Quote: Well, if you were to compare the load and get methods of the Hibernate Session, you'd think that they looked pretty darned similar; and you'd be ...

57. Cross-DB String representation of dates in HQL?    forum.hibernate.org

I want to pass a query like this to Hibernate3 HQL: Code: from abc where dateItem > '2008-11-04' I realise that the reference way to do this is to used a named variable in the query and then set it from Java code, but I can't easily do that because the query text is ad-hoc, built from a Velocity template. I ...

58. Quick deep copy of hughe object graph via DB possible?    forum.hibernate.org

Hi, I just want to deep copy an object graph loaded from db. (Haven't implemented clone for all classes yet.) The idea is to load the object graph and change the root id (composite natural key) and to avoid that only the references are copied, I would like to set all other Id's of this graph to null. So saving the ...