[Hibernate-JIRA] Created: (HHH-5722) Method annotated with @PreUpdade is not called
by Oleksandr Alesinskyy (JIRA)
Method annotated with @PreUpdade is not called
----------------------------------------------
Key: HHH-5722
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5722
Project: Hibernate Core
Issue Type: Bug
Components: entity-manager
Affects Versions: 3.6.0
Environment: Java 1.6.0_21, Windows and Linux
Reporter: Oleksandr Alesinskyy
I have a class with methods annotated @PostLoad, @PrePersist, and @PreUpdate as below:
{code:title=Snippet}
@Transient
private B2BCustomerKeyPo b2BCustomerKey;
@Embedded
@AttributeOverrides( { @AttributeOverride(name = "username", column = @Column(name = "APPLICATION_NAME")),
@AttributeOverride(name = "b2BCustomerName", column = @Column(name = "B2BCUSTOMER_NAME")) })
private UserKeyPo applicationKey;
...
@SuppressWarnings("unused")
@PostLoad
private void postLoad() {
if (applicationKey != null) {
if (applicationKey.getB2BCustomerName() != null) {
b2BCustomerKey = new B2BCustomerKeyPo(applicationKey.getB2BCustomerName());
}
if (applicationKey.getUsername() == null) applicationKey = null;
}
}
@SuppressWarnings("unused")
@PrePersist
private void prePersist() {
if (b2BCustomerKey != null) {
if (applicationKey != null) {
if (!b2BCustomerKey.equals(new B2BCustomerKeyPo(applicationKey.getB2BCustomerName()))) {
final String msg =
String
.format(
"B2B customer [%s] of the product does not match the Application of the product [%s/%s]",
b2BCustomerKey.getName(), applicationKey.getB2BCustomerName(),
applicationKey.getUsername());
throw new IllegalStateException(msg);
}
} else {
applicationKey = new UserKeyPo(b2BCustomerKey.getName(), null);
}
}
}
@SuppressWarnings("unused")
@PreUpdate
private void preUpdate() {
throw new RuntimeException("§TEST§");
}
{code}
prePersist and postLoad methods work as expected but preUpdate method is not called at all - while updated fields are dutifully written into DB (they never would if preUopdate will be called).
The code manipulating the object is as below:
{code:title=Snippet2}
ProductPo productPoOld = readProductPo(input.getProduct().getProductKey().getExternalProductKey());
...
B2BCustomerKey b2bCustomerKey = productNew.getB2BCustomerKey();
productPoOld.setB2BCustomerKey(mappingHelper.mapObject(productNew.getB2BCustomerKey(),
B2BCustomerKeyPo.class));
LOG.debug(productPoOld.getB2BCustomerKey());
// @PreUpdate method is not called regardless if flush is present below or not
productDao.flush();
{code}
--
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, 5 months
[Hibernate-JIRA] Created: (HHH-4581) Embedded objects in criteria API does not work
by Jaroslaw Lewandowski (JIRA)
Embedded objects in criteria API does not work
----------------------------------------------
Key: HHH-4581
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4581
Project: Hibernate Core
Issue Type: Bug
Components: query-criteria
Affects Versions: 3.5.0-Beta-2
Reporter: Jaroslaw Lewandowski
It not possible to use Embedded attribute in Criteria API. E.g. having the following entity
@Entity
class Client {
@Embedded
private Name name;
}
@Embeddable
public class Name implements Serializable {
@Basic
private String firstName;
@Basic
private String lastName;
}
The following throws an exception
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<ClientCard> cq = cb.createQuery(Client.class);
Root<ClientCard> root = cq.from(ClientCard.class);
cq.where(cb.equal(root.get(Client_.name).get(Name_.firstName)), "blah");
em.createQuery(cq).getResultList();
Saying that Name is not managed entity:
Caused by: java.lang.IllegalArgumentException: Not an managed type: class com.phorest.memento.server.domain.Name
at org.hibernate.ejb.metamodel.MetamodelImpl.managedType(MetamodelImpl.java:171)
at org.hibernate.ejb.criteria.JoinImpl.<init>(JoinImpl.java:54)
at org.hibernate.ejb.criteria.FromImpl.constructJoin(FromImpl.java:193)
at org.hibernate.ejb.criteria.FromImpl.join(FromImpl.java:176)
at org.hibernate.ejb.criteria.FromImpl.join(FromImpl.java:169)
at org.hibernate.ejb.criteria.FromImpl.get(FromImpl.java:559)
--
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, 5 months
[Hibernate-JIRA] Created: (HBX-1171) Eclipse plugin, shows text in "red" color on the "console tab".
by mCruiseOn (JIRA)
Eclipse plugin, shows text in "red" color on the "console tab".
---------------------------------------------------------------
Key: HBX-1171
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1171
Project: Hibernate Tools
Issue Type: Bug
Components: eclipse
Affects Versions: 3.2.1
Reporter: mCruiseOn
Text in the console screen shows up in "red" on eclipse. Red color should be used to denote "errors" not progress. Its very disturbing to see red as hibernate loads. Below is a snapshot of the text that appears in red.
9 Dec, 2010 5:35:04 PM org.hibernate.cfg.annotations.Version <clinit>
INFO: Hibernate Annotations 3.5.1-Final
9 Dec, 2010 5:35:04 PM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.5.1-Final
9 Dec, 2010 5:35:04 PM org.hibernate.cfg.Environment <clinit>
INFO: loaded properties from resource hibernate.properties: {hibernate.connection.username=root, hibernate.connection.password=****, hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect, hibernate.connection.pool_size=2, hibernate.connection.url=jdbc:mysql://localhost/mCruiseOnServerDB, hibernate.bytecode.use_reflection_optimizer=false, hibernate.connection.driver_class=com.mysql.jdbc.Driver}
9 Dec, 2010 5:35:04 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : javassist
9 Dec, 2010 5:35:04 PM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
9 Dec, 2010 5:35:04 PM org.hibernate.annotations.common.Version <clinit>
INFO: Hibernate Commons Annotations 3.2.0.Final
9 Dec, 2010 5:35:04 PM org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
9 Dec, 2010 5:35:04 PM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
9 Dec, 2010 5:35:04 PM org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : com/mcruiseon/server/hibernate/tables/DeviceDetails.hbm.xml
9 Dec, 2010 5:35:04 PM org.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
9 Dec, 2010 5:35:04 PM org.hibernate.cfg.search.HibernateSearchEventListenerRegister enableHibernateSearch
INFO: Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
9 Dec, 2010 5:35:04 PM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: com.mcruiseon.server.hibernate.tables.DeviceDetails -> deviceDetails
9 Dec, 2010 5:35:04 PM org.hibernate.cfg.AnnotationConfiguration applyHibernateValidatorLegacyConstraintsOnDDL
INFO: Hibernate Validator not found: ignoring
9 Dec, 2010 5:35:04 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
9 Dec, 2010 5:35:04 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 2
9 Dec, 2010 5:35:04 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: false
9 Dec, 2010 5:35:04 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost/mCruiseOnServerDB
9 Dec, 2010 5:35:04 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=root, password=****}
9 Dec, 2010 5:35:05 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: RDBMS: MySQL, version: 5.1.41-3ubuntu12.7
9 Dec, 2010 5:35:05 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.12 ( Revision: ${bzr.revision-id} )
9 Dec, 2010 5:35:05 PM org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.MySQLInnoDBDialect
9 Dec, 2010 5:35:05 PM org.hibernate.engine.jdbc.JdbcSupportLoader useContextualLobCreation
INFO: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
9 Dec, 2010 5:35:05 PM org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Using default transaction strategy (direct JDBC transactions)
9 Dec, 2010 5:35:05 PM org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
9 Dec, 2010 5:35:05 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
9 Dec, 2010 5:35:05 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
9 Dec, 2010 5:35:05 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch size: 15
9 Dec, 2010 5:35:05 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch updates for versioned data: disabled
9 Dec, 2010 5:35:05 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: enabled
9 Dec, 2010 5:35:05 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): enabled
9 Dec, 2010 5:35:05 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Connection release mode: auto
9 Dec, 2010 5:35:05 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Maximum outer join fetch depth: 2
9 Dec, 2010 5:35:05 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default batch fetch size: 1
9 Dec, 2010 5:35:05 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: disabled
9 Dec, 2010 5:35:05 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
9 Dec, 2010 5:35:05 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL inserts for batching: disabled
9 Dec, 2010 5:35:05 PM org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
9 Dec, 2010 5:35:05 PM org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
INFO: Using ASTQueryTranslatorFactory
9 Dec, 2010 5:35:05 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
9 Dec, 2010 5:35:05 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JPA-QL strict compliance: disabled
9 Dec, 2010 5:35:05 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
9 Dec, 2010 5:35:05 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: disabled
9 Dec, 2010 5:35:05 PM org.hibernate.cfg.SettingsFactory createRegionFactory
INFO: Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory
9 Dec, 2010 5:35:05 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: disabled
9 Dec, 2010 5:35:05 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Structured second-level cache entries: disabled
9 Dec, 2010 5:35:05 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Statistics: disabled
9 Dec, 2010 5:35:05 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Deleted entity synthetic identifier rollback: disabled
9 Dec, 2010 5:35:05 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default entity-mode: pojo
9 Dec, 2010 5:35:05 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Named query checking : enabled
9 Dec, 2010 5:35:05 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Check Nullability in Core (should be disabled when Bean Validation is on): enabled
9 Dec, 2010 5:35:05 PM org.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
9 Dec, 2010 5:35:05 PM org.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: Not binding factory to JNDI, no JNDI name configured
--
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, 5 months
[Hibernate-JIRA] Commented: (HHH-1423) ParameterParser bug - ordinal parameter mismatch
by Strong Liu (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1423?page=c... ]
Strong Liu commented on HHH-1423:
---------------------------------
hi, guys, would you please confirm if this is fixed by HHH-3216? try the latest 3.6 release, thanks
if it is not, please provide a runnable test case
> ParameterParser bug - ordinal parameter mismatch
> -------------------------------------------------
>
> Key: HHH-1423
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1423
> Project: Hibernate Core
> Issue Type: Bug
> Components: query-hql
> Affects Versions: 3.1.2
> Environment: Windows XP SP2, JDK 1.5.0_06-b05, Spring 1.2.6, antlr-2.7.6rc1
> Reporter: Artur Wronski
> Assignee: Strong Liu
> Priority: Critical
> Attachments: HHH1423Test.java, ParameterParser.2.patch, ParameterParser.3.patch, ParameterParser.patch, RecognizerBug.java
>
>
> There is still problem with ParameterParser. The same was in Hibernate 3.1.1
> Runnable TestCase in attachment.
--
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, 5 months