function « Data Type « JPA Q&A





1. Cast function for Hibernate    stackoverflow.com

I have tried to cast to float numbers from string in the database fields to compare with another numbers. The field in the database was String type. I have tried to ...

2. NHibernate HQL date functions    stackoverflow.com

I'm writing a notification platform using C# and NHibernate. I'm having difficulties with my queries. I have a Customer entity - which contains an AssessmentCompleted Property. A notification should be sent out ...

3. How to use the CURRENT_DATE function in a hibernate criterion?    stackoverflow.com

I want to translate the following HQL into Criteria notation:

from Deal
where CURRENT_DATE between startDate and endDate
I tried using Restrictions.between but it doesn't recognize current_date
Criteria c = session().createCriteria(Deal.class)
   .add(Restrictions.between("CURRENT_DATE", "startDate", ...

4. Week(Date) Function in Grails/Hibernate Criteria    stackoverflow.com

i want to ask whether is it possible to get week number from date property of a domain with Grails or hibernate Criteria ? e.g in mysql it is WEEK(CURRENT_TIMESTAMP) Thanks in advance ...

5. Hibernate date function    forum.hibernate.org

7. @SQLInsert with current_timestamp function    forum.hibernate.org

8. Where does the date() function come from    forum.hibernate.org

9. Error using array_agg() PSQL function    forum.hibernate.org

String queryString = "select new PerformanceProfile(min(sp.id), sp.category, max(sp.samplecount), array_agg(sp.toptraces)) " + "from PerformanceProfile sp where sp.operation = '" + pageName + "' and " + "sp.keytype = 6 and sp.timewidth = 0 and ...





10. criteriaBuilder function throws No data type for node: org.h    forum.hibernate.org

Hello, I have this code which worked perfectly with eclipselink JPA implementation. CriteriaBuilder criteriaBuilder = em.getCriteriaBuilder(); CriteriaQuery criteriaQuery = criteriaBuilder.createTupleQuery(); Root from = criteriaQuery.from(MyTable.class); Predicate p = buildPredicate(); Expression indexName = "myIndex"; Expression textkey = from.get("id").as(Long.class); Expression textQuery = criteriaBuilder.literal("health"); Expression startTag = criteriaBuilder.literal(""); Expression endTag = criteriaBuilder.literal(""); Expression snippet = criteriaBuilder.function("CTX_DOC.snippet", String.class, indexName, textkey, textQuery, startTag, endTag); criteriaQuery.multiselect(from, snippet ); ...

11. Mysql - hql with DATE_ADD function    forum.hibernate.org

Hello guys!!! I have a mysql table called INTEGRANTE with a date field mapped : Code: @Temporal(TemporalType.DATE) @Column(name = "INTE_DT_ULTIMA_RENOVACAO_SMV", nullable=true) private Date dataUltimaRenovacaoSmv; I built the following query: Code: Map map = new HashMap(); ...

12. Null value single row functions    forum.hibernate.org

Oracle has an NVL function to convert a null field to whatever you want. In the Hibernate Mapping XML file, is there a way to do the same sort of thing? How would I specify that I wanted the bean value to be populated with 0 if the column field was null, based on the following definition?

13. using to_char function from hibernate    forum.hibernate.org

14. MySQL date functions - strange behavior?    forum.hibernate.org

I am new to both the Java community and Hibernate. I am attempting to use date functions and then aggregate them. Here is what I am doing: Code: Iterator i = session.createQuery("select s.person, sum(s.viewed), sum(time_to_sec(timeEnd) - time_to_sec(timeStart))" + "from SessionTrackerN s " + ...

15. Bug in SQL Server & Sybase date/time functions    forum.hibernate.org

// Get the first message that is ready to be processed from a queue. Message msg = (Message)session.createFilter(queue.getMessages(), "where ProcessAt >= current_timestamp() order by ProcessAt asc") ...

16. SQL Cast function problem with HQL    forum.hibernate.org





17. Date functions in Hibernate 3    forum.hibernate.org

18. HQL string functions    forum.hibernate.org

According to Hibernate documentation length(), as well as other EJB-QL 3.0 functions, such as trim(), are supported. However, the following HQL query does not work: select length(trim(obj.ObjName)) from Objective as obj While this HQL query works (on SQL Server): select len(ltrim(obj.ObjName)) from Objective as obj Am I missing something or should the documentation be corrected? Thanks.

19. Oracle and date functions    forum.hibernate.org

Query q = session.createQuery( "from Bank bk " + "where b.balanceDate > current_date - interval :time" ); ...

21. Problems with time functions    forum.hibernate.org

[b]Hibernate version: 3.1[/b] The problem I'm facing is that my query doesn't work in Hibernate, i'm having trouble with the intervals, but if I type the same query in MySQL's console i get the results, has anyone faced something like this?? I'll apreciate ANY help [b]Code between sessionFactory.openSession() and session.close():[/b] [code] String sql = "select count(*) from Table a WHERE (a.closedDate ...

22. HQL function CAST ( ... AS ... ) in criteria?    forum.hibernate.org

well... i have a string property in a table and i need to compare it with an integer either with Restrictions.eq or Restrictions.between. The property is string because i need to preserve the zeros in the beginning. I have already done this with queries using the "cast" function. Now i need to do it using criteria... I don't know what else ...

23. How can i use casting function in HQL?    forum.hibernate.org

24. how to use null check(NVL) function in HQL?    forum.hibernate.org

Hi, I am using Hibernate3.0. I want to know how to use null check function(NVL). My DB is Oracle 10g.My dialect is "org.hibernate.OracleDialect". I am using named querys. If i use NVL function directly, when Null value is going for Long or Integer I got error like "can't assign Binary value to Integer". In search condition if i have three fields ...

25. any null check(NVL) function in HQL?    forum.hibernate.org

Hi karthika, You haven't provided enough information, post the stack trace of the error you're getting. As for the functionality, if you check Oracle9Dialect.java in the src/org/hibernate/dialect directory of your Hibernate distribution, you will see that the NVL() function is defined and its HQL syntax is identical to SQL. Maybe you're using the wrong dialect? Cheers, Roger

26. Postgres Equivalent HQL Function    forum.hibernate.org

Hi, This is the SQL query used in postgres: select distinct tag_serialno from process_instances where tag_serialno='"+tag_serialno[i] +"' and state_id='"+ prevStateid +"' and timestamp_mi('" + dt + "',start_date) <= '" + timeperiod + "';"); in the above query timestamp_mi function is used to get the timestamp difference between the current time and the time specified in the start_date column. Is there any ...

27. Postgres Equivalent HQL Function    forum.hibernate.org

Hi, This is the SQL query used in postgres: select distinct tag_serialno from process_instances where tag_serialno='"+tag_serialno[i] +"' and state_id='"+ prevStateid +"' and timestamp_mi('" + dt + "',start_date) <= '" + timeperiod + "';"); in the above query timestamp_mi function is used to get the timestamp difference between the current time and the time specified in the start_date column. Is there any ...

28. [Criteria] How to use 'to_char' pgres function?    forum.hibernate.org

Hello, i'm trying to create a criteria to execute a SQL query that uses the 'to_char' function from postgres. I also need to make a cast from string to integer in the query. I just can't find a way to do it using Criteria. Code: SELECT documento.id as id_documento,alunopre.id as id_alunoPre FROM alunopre INNER JOIN nucleo on alunopre.nucleo_id = nucleo.id INNER ...

30. HQL Date function    forum.hibernate.org

31. How to use TO_DATE SQl function with Criteria API    forum.hibernate.org

Well, there's a few ways to go. Of course, the Criteria API is object based, so much depends on how many objects you have. This might easily be accomplished by creating an Accounts objects an using a greater than or less than Restriction on the salary range or date range, or whatever property you want to place a restriction on. Here's ...