Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1031651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T13:57:46+00:00 2026-05-16T13:57:46+00:00

Why does the UniqueConstraint annotation in the following Hibernate mapping declaration cause the exception

  • 0

Why does the UniqueConstraint annotation in the following Hibernate mapping declaration cause the exception java.lang.NoSuchMethodError: javax.persistence.UniqueConstraint.name() (see below for stack trace)? Note that when I remove the UniqueConstraint annotation, Hibernate does not throw the exception and Spring successfully creates the application context.

Source code:

@Entity
@Table(name="TB_USER_ACCESS"
    ,schema="ABSOL_USER"
    , uniqueConstraints = @UniqueConstraint(columnNames={"USER_ID", "BUSINESS_GROUP_ID", "BUSINESS_FUNCTION_ID"}) 
)
public class UserAccess  implements java.io.Serializable {
...

Exception stack trace:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.UniqueConstraint.name()Ljava/lang/String;
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
    at com.db.abstrack.util.SpringContextFactory.<init>(SpringContextFactory.java:18)
    at com.db.abstrack.util.SpringContextFactory.<clinit>(SpringContextFactory.java:13)
    ... 60 more
Caused by: java.lang.NoSuchMethodError: javax.persistence.UniqueConstraint.name()Ljava/lang/String;
    at org.hibernate.cfg.annotations.TableBinder.buildUniqueConstraintHolders(TableBinder.java:544)
    at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:550)
    at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:636)
    at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:359)
    at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1206)
    at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:717)
    at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
    ... 73 more

Software configuration:

  • Hibernate 3.5.5-Final
  • Spring 3.0.4.RELEASE
  • WebLogic Server 10.3.2

Relevant Maven 2 dependencies in pom.xml:

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-entitymanager</artifactId>
    <version>3.5.5-Final</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-orm</artifactId>
    <version>3.0.4.RELEASE</version>
    <scope>compile</scope>
</dependency>

Hibernate dependencies:

[INFO] +- org.hibernate:hibernate-entitymanager:jar:3.5.5-Final:compile
[INFO] |  +- org.hibernate:hibernate-core:jar:3.5.5-Final:compile
[INFO] |  |  +- antlr:antlr:jar:2.7.6:compile
[INFO] |  |  +- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  |  |  \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] |  |  \- javax.transaction:jta:jar:1.1:compile
[INFO] |  +- org.hibernate:hibernate-annotations:jar:3.5.5-Final:compile
[INFO] |  |  \- org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final:compile
[INFO] |  +- cglib:cglib:jar:2.2:compile
[INFO] |  |  \- asm:asm:jar:3.1:compile
[INFO] |  \- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.0.Final:compile

Spring dependencies:

[INFO] +- org.springframework:spring-orm:jar:3.0.4.RELEASE:compile
[INFO] |  +- org.springframework:spring-beans:jar:3.0.4.RELEASE:compile
[INFO] |  +- org.springframework:spring-core:jar:3.0.4.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-asm:jar:3.0.4.RELEASE:compile
[INFO] |  +- org.springframework:spring-jdbc:jar:3.0.4.RELEASE:compile
[INFO] |  \- org.springframework:spring-tx:jar:3.0.4.RELEASE:compile
[INFO] |     +- aopalliance:aopalliance:jar:1.0:compile
[INFO] |     +- org.springframework:spring-aop:jar:3.0.4.RELEASE:compile
[INFO] |     \- org.springframework:spring-context:jar:3.0.4.RELEASE:compile
[INFO] |        \- org.springframework:spring-expression:jar:3.0.4.RELEASE:compile
[INFO] +- net.sf.ehcache:ehcache-core:jar:2.2.0:compile
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T13:57:46+00:00Added an answer on May 16, 2026 at 1:57 pm

    UniqueConstraint.name() appears in JPA 2. Since you have the proper JPA dependencies, I’d assume your WebLogic has JPA 1.0 shipped, which overrides your jars. I think you can do this in your weblogic-application.xml (as noted here):

    <prefer-application-packages>
      <package-name>javax.persistence.*</package-name>
    </prefer-application-packages>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does the Java language have delegate features, similar to how C# has support for
Consider this unique constraint: ALTER TABLE Posts ADD CONSTRAINT UQ_Posts_Name UNIQUE (Name); Does it
Does Ehcache 2.1 now support the transactional cache concurrency strategy in Hibernate 3.3.2GA? That
I'm basically referring to this: Compound keys in JPA Is the @UniqueConstraint annotation a
Does Google force employees who have offers from Facebook to leave immediately?
Does anyone remember the XMP tag? What was it used for and why was
Does anybody know any good resources for learning how to program CIL with in-depth
Does anyone know how to get IntelliSense to work reliably when working in C/C++
Does anyone have any recommendations of tools that can be of assistance with moving
Does anyone use have a good regex library that they like to use? Most

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.