This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Hibernate, Relational Persistence for Idiomatic Java | |
* | |
* Copyright (c) 2013, Red Hat Inc. or third-party contributors as | |
* indicated by the @author tags or express copyright attribution | |
* statements applied by the authors. All third-party contributions are | |
* distributed under license by Red Hat Inc. | |
* | |
* This copyrighted material is made available to anyone wishing to use, modify, | |
* copy, or redistribute it subject to the terms and conditions of the GNU |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<hibernate-mapping> | |
<class entity-name="IncomingPartnerData" table="PARTNER_INCOMING_DATA"> | |
... | |
</class> | |
<class entity-name="IncomingCustomerData" table="CUSTOMER_INCOMING_DATA"> | |
... | |
</class> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<hibernate-mapping> | |
<class name="IncomingData" entity-name="IncomingPartnerData" table="PARTNER_INCOMING_DATA"> | |
... | |
</class> | |
<class name="IncomingData" entity-name="IncomingCustomerData" table="CUSTOMER_INCOMING_DATA"> | |
... | |
</class> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pom.withXml { | |
def root = asNode(); | |
root.appendNode( 'url', 'http://hibernate.org' ) | |
def org = root.appendNode( 'organization' ) | |
org.appendNode( 'name', 'Hibernate.org' ) | |
org.appendNode( 'url', 'http://hibernate.org' ) | |
def jira = root.appendNode( 'issueManagement' ) | |
jira.appendNode( 'system', 'jira' ) | |
jira.appendNode( 'url', 'https://hibernate.atlassian.net/browse/HHH' ) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
public class Membership implements IMembership { | |
@EmbeddedId | |
private MembershipKey id; | |
} | |
@Embeddable | |
public final class MembershipKey implements IMembershipKey, Serializable { | |
@ManyToOne | |
private User user; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
public class SomeHolderOfAttributes { | |
... | |
@OneToMany( ... ) | |
@JoinColumn( ... ) | |
@OrderColumn( ... ) | |
@CollectionType( type=AtributeListDescriptor.class ) | |
private List<Attribute> atributes; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
@Table(name = "ACTIVITY") | |
@Audited | |
public class Activity implements Serializable { | |
@Id | |
@Column(name = "Id") | |
@GeneratedValue(strategy = GenerationType.AUTO) | |
private long id; | |
@ManyToOne |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyDialectResolver implements DialectResolver { | |
public Dialect resolveDialect(DatabaseMetaData metaData) { | |
if ( "H2".equals( metaData.getDatabaseProductName ) ) { | |
return MyH2Dialect.INSTANCE; | |
} | |
else if ( "PostgreSQL".equals( metaData.getDatabaseProductName ) ) { | |
return MyPgsqlDialect.INSTANCE; | |
} | |
return null; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private EntityLoader getAppropriateUniqueKeyLoader(String propertyName, SessionImplementor session) { | |
final boolean useStaticLoader = !session.getLoadQueryInfluencers().hasEnabledFilters() | |
&& !session.getLoadQueryInfluencers().hasEnabledFetchProfiles() | |
//ugly little workaround for fact that createUniqueKeyLoaders() does not handle component properties | |
&& propertyName.indexOf( '.' ) < 0; | |
if ( useStaticLoader ) { | |
EntityLoader loader = (EntityLoader) uniqueKeyLoaders.get( propertyName ); | |
if ( loader == null ) { | |
if ( propertyName.equals( entityMetamodel.getIdentifierProperty().getName() ) ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.hql.QueryExecutionRequestException: Not supported for DML operations [DELETE FROM com.xxx.xx.xxx.domain.feed.Feed f WHERE f.id NOT IN (SELECT MAX(ff.id) FROM com.xxx.xx.xxx.domain.feed.Feed ff WHERE ff.person.id =:personId GROUP BY ff.date,ff.app,ff.unitType) AND f.person.id=:personId]; nested exception is java.lang.IllegalStateException: org.hibernate.hql.QueryExecutionRequestException: Not supported for DML operations [DELETE FROM com.xxx.xx.xxx.domain.feed.Feed f WHERE f.id NOT IN (SELECT MAX(ff.id) FROM com.xxx.xx.xxx.domain.feed.Feed ff WHERE ff.person.id =:personId GROUP BY ff.date,ff.app,ff.unitType) AND f.person.id=:personId] | |
at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:298) ~[spring-orm-3.1.0.RELEASE.jar:3.1.0.RELEASE] | |
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:106) ~[spring-orm-3 |