[Hibernate-JIRA] Created: (HCANN-19) Issue with @Column( ) annotation
by Prakash G (JIRA)
Issue with @Column( ) annotation
--------------------------------
Key: HCANN-19
URL: http://opensource.atlassian.com/projects/hibernate/browse/HCANN-19
Project: Hibernate Commons Annotations
Issue Type: Bug
Reporter: Prakash G
We all know that when we don't map a attribute with column in the DB using @Column() annotation, hibernate by default splits the variable based on the words and constructs the column name to be mapped.
Example
if I have something like
private BigDecimal netLiqPercent;
then hibernate constructs the column name as net_liq_percent.
But when we use
@Column(name ="Account_NetLiq_Percent", nullable=true, updatable=true, insertable=true)
private BigDecimal netLiqPercent;
Hibernate should not try to resolve / construct column, instead it should use whatever the column name is being specified.
However its not so! In the above case hibernate tries to look for column "account_net_liq_percent" and gives unknown column exception.
I believe when we explicitly map the column hibernate should use it.
but it works if I change column name to all CAPS..!
I think this needs to be addressed.
--
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
16 years
[Hibernate-JIRA] Created: (HHH-5120) LazyGroup Loading Mechanism
by Demidovich Artem (JIRA)
LazyGroup Loading Mechanism
---------------------------
Key: HHH-5120
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5120
Project: Hibernate Core
Issue Type: Improvement
Components: core
Environment: Hibernate
Reporter: Demidovich Artem
Priority: Minor
I would like to suggest a new functionality, which could improve Lazy loading. For Example, I have bussines objects and there is an object named Company.
Company has many fields, but I can separate Company fields in two or three logical groups and those fields of the object can be groupped in LazyGroups (for example "LazyGroup1", "LazyGroup2"). Now if caller tries to get some field from the LazyGroup1 then Nibernate will load all fields from this group.
Just for example
Company Type LazyGroup
1. Name (string)
2. Postal Code (string)
3. Address (Address Object)
4. Wokers (Lazy Collection)
5. Contracts (Lazy Collection) (LazyGroup = 'LG1')
6. Clients (Lazy Collection) (LazyGroup = 'LG1')
7. BussinesInfo (string) (LazyGroup = 'LG2')
8. BussinesRegions (Lazy Collection) (LazyGroup = 'LG2')
8. BussinesPartners (Lazy Collection) (LazyGroup = 'LG2')
So, if I call BussinesInfo getter then Hibernate should load all fields in 'LG2' LazyGroup (BussinussInfo, BussinessRegions, BussinesPartners).
This improvement will descrease amount of sql queries, because hibernate will use one query for loading all fields from the lazy group rather than calling one query per field.
--
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
16 years
[Hibernate-JIRA] Created: (HHH-5119) LazyInitializationException on OneToMany relationship if relation is not on Primary Key
by Simon Martinelli (JIRA)
LazyInitializationException on OneToMany relationship if relation is not on Primary Key
---------------------------------------------------------------------------------------
Key: HHH-5119
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5119
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.5.0-Final
Environment: Hibernate 3.5.0-Final with Derby DB and Oracle 10g
Reporter: Simon Martinelli
Attachments: JPA2_M2M.tar.gz
I created two entities One and Two.
One has a OneToMany relationship to Two.
@OneToMany
@JoinColumn(insertable = false, updatable = false, name = "SCHLUESSEL", referencedColumnName = "SCHLUESSEL")
private List<Two> twos = new ArrayList<Two>();
Important notice: SCHLUESSEL is not the primary key of Two!
I have the following test code:
List<One> ones = em.createQuery("select o from One o").getResultList();
for (One one : ones) {
logger.info(one.getName());
//em.refresh(one);
for (Two two : one.getTwos()) {
logger.info(two.getText());
}
}
When I run a test and try to access "twos" I get an excpetion:
2002 [main] ERROR org.hibernate.LazyInitializationException - failed to lazily initialize a collection of role: ch.test.One.twos, no session or session was closed
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: ch.test.One.twos, no session or session was closed
at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:380)
at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:372)
After uncommenting em.refresh it works.
--
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
16 years
[Hibernate-JIRA] Updated: (HHH-1851) relax special handling of 'id' property
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1851?page=c... ]
Steve Ebersole updated HHH-1851:
--------------------------------
Fix Version/s: (was: 3.5.1)
3.5.x
> relax special handling of 'id' property
> ---------------------------------------
>
> Key: HHH-1851
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1851
> Project: Hibernate Core
> Issue Type: Improvement
> Components: query-hql
> Environment: independent, all versions all databases.
> Reporter: Gunther Schadow
> Assignee: Steve Ebersole
> Fix For: 3.5.x
>
> Attachments: IdClassAndAnotherPropertyNamedId.zip
>
>
> Hibernate has long treated 'id' in a special manner in HQL and Criteria queries. The drawback to this has always been that it effectively means users cannot define non-identifier properties named id and refer to those properties in HQL/Criteria queries.
> Thus, I will change this such that:
> (1) 'id' can still be used to refer to the identifier property, whatever the property's actual name, as long as the entity does not define a non-identitifer property named id.
> (2) if the entity defines a non-identifier property named 'id', using 'id' in HQL or Criteria queries will refer to this non-identifier property; users would need to refer to the identifier property by its actual name.
> FYI, the original reason for this feature was to support entity's which did not define an identifier property at all (users were responsible for managing the ids seperately. That feature was never really recommended and has been deprecated since early in the 3.x development.
--
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
16 years
[Hibernate-JIRA] Created: (HHH-4965) Bug in org.hibernate.ejb.QueryImpl
by jean-claude cote (JIRA)
Bug in org.hibernate.ejb.QueryImpl
----------------------------------
Key: HHH-4965
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4965
Project: Hibernate Core
Issue Type: Bug
Components: entity-manager
Affects Versions: 3.5.0-CR-1
Reporter: jean-claude cote
Priority: Minor
Emmanuel
There seems to be a bug in the QueryImpl class in the method
extractParameterInfo()
Here's what I've done:
I create an equal predicate using a Path to House.address and a Address value.
@Entity
class House
{
@Type(type="jc.AddressUserType")
@Columns(columns={@Column(name="address")})
Address address;
In the extractParameterInfo() method there is a loop that gets the
javaType from a namedParameterTypeRedefinition.
It gets the javaType (Address.class) then since it is not null tries
to find the hibernate Type using the TypeFactory.heuristicType()
method. But given a javaType this will only work for strings, int,
double etc. What is passed in is an Address not an AddressUserType.
The huristicType actually returns an hibernate SerializableType and
resets the descriptor which was correct in the first place.
I've fix this for myself my just commenting out the call to
resetExpectedType but there must be a good reason why this call is
made there correct?
Thanks
Jean-Claude
@SuppressWarnings({ "unchecked", "RedundantCast" })
private void extractParameterInfo(Map<String,Class>
namedParameterTypeRedefinition) {
if ( ! AbstractQueryImpl.class.isInstance( query ) ) {
throw new IllegalStateException( "Unknown query type for parameter
extraction" );
}
HashSet<Parameter<?>> parameters = new HashSet<Parameter<?>>();
AbstractQueryImpl queryImpl = AbstractQueryImpl.class.cast( query );
// extract named params
for ( String name : (Set<String>)
queryImpl.getParameterMetadata().getNamedParameterNames() ) {
final NamedParameterDescriptor descriptor =
queryImpl.getParameterMetadata().getNamedParameterDescriptor( name );
Class javaType = namedParameterTypeRedefinition.get( name );
if ( javaType != null ) {
descriptor.resetExpectedType(
TypeFactory.heuristicType( javaType.getName() )
);
}
else if ( descriptor.getExpectedType() != null ) {
javaType = descriptor.getExpectedType().getReturnedClass();
}
final ParameterImpl parameter = new ParameterImpl( name, javaType );
parameters.add( parameter );
if ( descriptor.isJpaStyle() ) {
if ( jpaPositionalIndices == null ) {
jpaPositionalIndices = new HashSet<Integer>();
}
jpaPositionalIndices.add( Integer.valueOf( name ) );
}
}
--
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
16 years
[Hibernate-JIRA] Created: (HHH-5059) callouts and programlistings with highlighting
by Steve Ebersole (JIRA)
callouts and programlistings with highlighting
----------------------------------------------
Key: HHH-5059
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5059
Project: Hibernate Core
Issue Type: Bug
Components: documentation
Reporter: Steve Ebersole
Assignee: Steve Ebersole
Priority: Blocker
Fix For: 3.5.x
Attempting to use callouts with programlistings that apply highlighting break horrifically :( Actually it seems to be ok for pdf; still need to investigate more. However it for certain goes horribly wrong on html formats.
We need to fix this and push a 3.5.1 asap to have proper 3.5 documentation available.
The problem is that this is an issue with the "JBoss.org jDocBook styles". And the fix is not yet known nor expected to be trivial. So how long so we wait? Because the work around is to remove the highlighting when using callouts; in other words, for all <programlistingco> tags, we need to make sure the nested <programlisting> tags do not specify the role attribute. Then when (if ever) the "JBoss.org jDocBook styles" is fixed we will need to go and add back the highlighting.
--
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
16 years