[Hibernate-JIRA] Created: (HHH-6840) to_char function with hsqldb doesn't work
by Roozbeh Maadani (JIRA)
to_char function with hsqldb doesn't work
-----------------------------------------
Key: HHH-6840
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6840
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Affects Versions: 3.6.8
Environment: Hibernate 3.6.8.Final and HSQLDB 2.2.4
Reporter: Roozbeh Maadani
Priority: Minor
Hi,
We are developing a project which uses hibernate 3.6.8.final , Oracle 10g database in production and a in-memory Hsqldb for unittests. In our hql queries, we use "to_char" function which should work both for Oracle 10g and Hsqldb version 2.2 and above. There is no problem in production (Oracle10gDialect) but when we run the tests (for tests we use HSQLDialect ) we get the following mystic error:
org.hsqldb.HsqlException: user lacks privilege or object not found: TO_CHAR
And it is possible to see in the logs that HSQLDialect doesn't generate correct sql.
After tracing the code I found out that HSQLDialect doesn't register "to_char" function for hsqldb 2.2.x. The following code solved the problem:
public class MyHSQLDialect extends HSQLDialect
{
public MyHSQLDialect()
{
super();
registerFunction( "to_char", new StandardSQLFunction( "to_char" ) );
}
}
I suppose it is possible to move this code to the HSQLDialect constructor and solve this issue.
Regards,
Roozbeh Maadani
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years
[Hibernate-JIRA] Created: (HHH-6920) Jboss7 with Insert into select query
by sabbirali kadiwala (JIRA)
Jboss7 with Insert into select query
------------------------------------
Key: HHH-6920
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6920
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 4.0.0.Final
Environment: I am using jboss-as-7.0.2.Final, its using hibernate 4.x. I am using oracle 10g as database.
Reporter: sabbirali kadiwala
In my application we used "insert into select" query for improve performance which is running fine in jboss6.
But
with jboss7 it is giving error as below
ErrorMessage:
javax.ejb.EJBTransactionRolledbackException: org.hibernate.QueryException: can only generate ids as part of bulk insert with either sequence or post-insert style generators [insert into ScheduleDetails(mstSchedule,articleCode,vendorCode,valuationClass,ruleClass) select ts.mstSchedule,ma.id.articleCode,tg.vendorCode,tg.valuationClass,'O' from com.eks.ias.service.core.entity.TransGp tg, com.eks.ias.service.core.entity.MstArticle ma,com.eks.ias.service.schedule.entity.TransSchedule ts where ts.id.scheduleReferenceId = :scheduleRefId and tg.id.siteCode = :siteCode and ma.isDeleted=false and tg.id.articleCode=ma.id.articleCode and tg.id.siteCode = ts.mstSchedule.mstSite.siteCode and ts.mstSchedule.mstSite.sapVersion = ma.id.sapVersion and ma.mstMc.mcCode = ts.id.mcCode ]
and entity looks like
@Entity
@Table(name = "SCHEDULE_DETAILS")
@SequenceGenerator(name = "SCHEDULE_DETAILS_ID_GENERATOR", sequenceName = "MST_SCHEDULE_DETAILS_ID_SEQ", initialValue = 1, allocationSize = 1)
public class ScheduleDetails implements java.io.Serializable
{
private Long scheduleDetailsId;
private MstSchedule mstSchedule;
.....
// we have some constructor also
...
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SCHEDULE_DETAILS_ID_GENERATOR")
@Column(name = "SCHEDULE_DETAILS_ID", unique = true, nullable = false, precision = 38, scale = 0)
public Long getScheduleDetailsId() {
return this.scheduleDetailsId;
}
>From Jboss7 Community i got below reply
@GeneratedValue(SEQUENCE) maps to org.hibernate.id.enhanced.SequenceStyleGenerator, which isn't checked for in org.hibernate.hql.internal.ast.HqlSqlWalker.supportsIdGenWithBulkInsertion().
As previously discussed here, hibernate.id.new_generator_mappings is set to true by default, and as a result, class SequenceStyleGenerator is used instead of class SequenceHiLoGenerator (which is checked for in the above supportsIdGenWithBulkInsertion).
Could you create a Hibernate (against 4.0.0.Final) jira for this bug, the link is here.
Please reply when it got resolved and in which version..
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years
[Hibernate-JIRA] Created: (HHH-6871) SingletonEhCacheProvider shoud not shutdown singleton CacheManager if it doesn't own it
by Adrien (JIRA)
SingletonEhCacheProvider shoud not shutdown singleton CacheManager if it doesn't own it
---------------------------------------------------------------------------------------
Key: HHH-6871
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6871
Project: Hibernate Core
Issue Type: Bug
Components: caching (L2)
Affects Versions: 4.0.0.CR7, 3.6.8
Reporter: Adrien
Priority: Minor
SingletonEhCacheProvider use a static referenceCount every time a sessionFactory wants a CacheManager, and shutdown it when all sessionFactories are gone. But Hibernate may not be the only one using it. In our case, we have manual configuration of the CacheManager singleton and cache regions not managed by Hibernate. The simple fact of creating a SessionFactory, then close it shutdown the singleton, with our configuration and cache regions.
It's hard to know if Hibernate is the only one using EhCache and it's cool that Hibernate close the EhCache threads for most configurations, but in our case, it's a real problem. We manually call new SingletonEhCacheProvider().start(null) to increment the referenceCount, but others will have the problem.
My proposition is that before accessing for the first time to the CacheManager (referenceCount, Hibernate check if it's already exist (meaning it's already been used by someoneelse). If so, it increment the referenceCount to be sure Hibernate will never shutdown the CacheManager. Something like :
public void start(Settings settings, Properties properties) throws CacheException {
(...)
if (referenceCount.get() == 0 && CacheManager.getCacheManager(null) != null) {
REFERENCE_COUNT.incrementAndGet();
}
(...)
}
There may be some multi-thread issues with this code, but it's just the idea.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years
[Hibernate-JIRA] Created: (HSEARCH-1011) Unable to load entities with composite id using HSQLDB
by Baptiste MATHUS (JIRA)
Unable to load entities with composite id using HSQLDB
------------------------------------------------------
Key: HSEARCH-1011
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-1011
Project: Hibernate Search
Issue Type: Bug
Affects Versions: 3.1.1.GA
Environment: HSQLDB 1.8.0.2
Reporter: Baptiste MATHUS
Hi,
Hibernate Search actually manages to find entries in the lucene index, but then it fails trying to load them.
In fact, this issue seems to boil down to HSQLDB not supporting a query of this kind "...where (a,b) in (('x','y'))".
{{Caused by: java.sql.SQLException: Unexpected token: , in statement}}
This issue doesn't appear with Oracle, which is our production database. But it prevents us from unit/integration testing our code (using Arquillian/hsqldb/dbunit), which is in fact not very cool.
After that [discussion on the forum|https://forum.hibernate.org/viewtopic.php?f=9&t=1013645&sid=3f56cef...], I've taken some time to create a test project (I'll host in a dedicated github repository, actually).
As explained on the forum, I guess I'm stuck using 3.1.1.GA, since we're using JBoss EAP 5.x.
Do you think that could be fixed?
If you give me pointers so that I can see if I can propose a patch, would it even be possible to release a 3.x version of hsearch?
Thanks for your answers.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years
[Hibernate-JIRA] Created: (HHH-5257) @JoinTable results in redundant join in the generated SQL
by Sharath Reddy (JIRA)
@JoinTable results in redundant join in the generated SQL
---------------------------------------------------------
Key: HHH-5257
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5257
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.2
Reporter: Sharath Reddy
Priority: Minor
Fix For: 3.6
Attachments: testcase.zip
An Account can have several Clients:
@Entity
@Table(name = "CLIENT")
public class Client implements Serializable {
private String street;
private String code;
private String city;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@ManyToOne
@JoinTable(name = "CLIENT_ACCOUNT",
joinColumns = {@JoinColumn(name = "FK_CLIENT", referencedColumnName = "ID")},
inverseJoinColumns = {@JoinColumn(name = "FK_ACCOUNT", referencedColumnName = "ID")})
private Account account;
.....
}
@Entity
@Table(name = "ACCOUNT")
public class Account implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
private String number;
private double balance;
@OneToMany (fetch = FetchType.EAGER, mappedBy="account")
private Set<Client> holders;
...
}
When we load the Account entity:
Account a1 = (Account) session.load(Account.class, accountId);
We see that there is a redundant join at the end - from the CLIENT table to the CLIENT_ACCOUNT table:
select
account0_.id as id2_1_,
account0_.balance as balance2_1_,
account0_.number as number2_1_,
holders1_.FK_ACCOUNT as FK1_2_3_,
client2_.id as FK2_3_,
client2_.id as id0_0_,
client2_.city as city0_0_,
client2_.code as code0_0_,
client2_.street as street0_0_,
client2_1_.FK_ACCOUNT as FK1_1_0_
from
ACCOUNT account0_
left outer join
CLIENT_ACCOUNT holders1_
on account0_.id=holders1_.FK_ACCOUNT
left outer join
CLIENT client2_
on holders1_.FK_CLIENT=client2_.id
left outer join
CLIENT_ACCOUNT client2_1_
on client2_.id=client2_1_.FK_CLIENT
where
account0_.id=?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years
[Hibernate-JIRA] Created: (HV-533) @Digits.fraction should allow negative values
by Devesh Parekh (JIRA)
@Digits.fraction should allow negative values
---------------------------------------------
Key: HV-533
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-533
Project: Hibernate Validator
Issue Type: Bug
Components: documentation, validators
Affects Versions: 4.2.0.Final
Reporter: Devesh Parekh
There are really two bugs here:
1. The documentation for @Digits.fraction does not concretely say what should happen for negative values, but the 1.0 final spec defines the correct behavior on page 133 with the equation @Column.precision = @Digits.integer + @Digits.fraction. This suggests that @Digits.fraction should be negative when @Column.scale is negative.
2. The implementation throws an IllegalArgumentException when @Digits.fraction is negative.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years
[Hibernate-JIRA] Created: (HHH-2511) generated="insert/always" ignored for property in composite-element?
by James Garrison (JIRA)
generated="insert/always" ignored for property in composite-element?
--------------------------------------------------------------------
Key: HHH-2511
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2511
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.2
Environment: Hibernate 3.2.2, Windows XP SP2, Oracle 9i
Reporter: James Garrison
Priority: Minor
I have a composite-element (in an idbag) that has a db-generated timestamp
property. I have defined the property with update="false" insert="false" generated="insert",
but Hibernate is trying to insert a null value when saving a transient object.
See below, the "createTs" property (column=CREATE_TS) in the "comments"
composite-element.
DDL:
create table CR_COMMENT
(
COMMENT_ID integer not null,
REQ_ID integer not null,
CREATE_TS timestamp default sysdate not null,
SECTION_ID char(1) not null,
USER_ID varchar2(20) not null,
TEXT varchar2(4000) not null,
primary key(COMMENT_ID),
foreign key(REQ_ID) references CR_REQUEST (REQ_ID) on delete cascade
);
Mapping:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.wholefoods.ittoolkit.ws.ccf">
<class name="Request" table="CR_REQUEST">
<id name="reqId" column="REQ_ID" type="long">
<generator class="sequence">
<param name="sequence">CR_REQUEST_ID</param>
</generator>
</id>
[snip]
<idbag name="comments" table="CR_COMMENT">
<collection-id type="long" column="COMMENT_ID">
<generator class="sequence">
<param name="sequence">CR_COMMENT_ID</param>
</generator>
</collection-id>
<key column="REQ_ID" />
<composite-element class="Comment">
<property name="createTs" column="CREATE_TS"
type="calendar"
access="field"
update="false"
insert="false"
generated="insert" />
<property name="sectionId" column="SECTION_ID" />
<property name="userId" column="USER_ID" />
<property name="text" column="TEXT"/>
</composite-element>
</idbag>
</class>
</hibernate-mapping>
Log Output:
Hibernate:
/* insert collection
row com.wholefoods.ittoolkit.ws.ccf.Request.comments */ insert
into
ITTOOLKIT.CR_COMMENT
(REQ_ID, COMMENT_ID, CREATE_TS, SECTION_ID, USER_ID, TEXT)
values
(?, ?, ?, ?, ?, ?)
10:15:01,659 DEBUG org.hibernate.jdbc.AbstractBatcher:476 - preparing statement
10:15:01,675 DEBUG org.hibernate.type.LongType:133 - binding '47' to parameter: 1
10:15:01,675 DEBUG org.hibernate.type.LongType:133 - binding '7' to parameter: 2
10:15:01,675 DEBUG org.hibernate.type.CalendarType:126 - binding null to parameter: 3
10:15:01,675 DEBUG org.hibernate.type.StringType:133 - binding 'A' to parameter: 4
10:15:01,690 DEBUG org.hibernate.type.StringType:133 - binding 'garrisoj' to parameter: 5
10:15:01,690 DEBUG org.hibernate.type.StringType:133 - binding 'This is a test comment' to parameter: 6
10:15:01,690 DEBUG org.hibernate.persister.collection.AbstractCollectionPersister:1172 - done inserting collection: 1 rows inserted
10:15:01,690 DEBUG org.hibernate.jdbc.AbstractBatcher:44 - Executing batch size: 1
10:15:01,737 DEBUG org.hibernate.jdbc.AbstractBatcher:366 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
10:15:01,737 DEBUG org.hibernate.jdbc.AbstractBatcher:525 - closing statement
10:15:01,768 DEBUG org.hibernate.util.JDBCExceptionReporter:69 - Could not execute JDBC batch update
[/* insert collection row com.wholefoods.ittoolkit.ws.ccf.Request.comments */
insert into ITTOOLKIT.CR_COMMENT (REQ_ID, COMMENT_ID, CREATE_TS, SECTION_ID, USER_ID, TEXT)
values (?, ?, ?, ?, ?, ?)]
java.sql.BatchUpdateException: ORA-01400: cannot insert NULL into ("ITTOOLKIT"."CR_COMMENT"."CREATE_TS")
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
13 years
[Hibernate-JIRA] Created: (HHH-6063) The fix for HHH-5126 breaks array constructor in PostgreSQL
by Jon Vincent (JIRA)
The fix for HHH-5126 breaks array constructor in PostgreSQL
-----------------------------------------------------------
Key: HHH-6063
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6063
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 4.0.0.Alpha1, 3.6.2, 3.6.1
Environment: PostgreSQL, any version
Reporter: Jon Vincent
The fix for HHH-5126 supports this JPA2-compliant IN query:
{{{
SELECT * FROM my_table WHERE id IN :collection
}}}
Before HHH-5126 was fixed, Hibernate required the developer to surround collection-valued parameters with parentheses:
{{{
SELECT * FROM my_table WHERE id IN (:collection)
}}}
The implemented fix was simply to output parentheses in the generated SQL. Unfortunately, this breaks _other_ uses of collection-values parameters, such as for arrays in PostgreSQL:
{{{
CREATE TABLE my_table (some_array INTEGER[]);
INSERT INTO my_table (some_array) VALUES (ARRAY[:collection]);
}}}
Is there a way to turn off the fix for HHH-5126? For us, at least, the old code was more flexible and allowed access to important database features.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years