[Hibernate-JIRA] Created: (HHH-3416) Validation schema not work with sequence throws synonym
by Libor Tvrdík (JIRA)
Validation schema not work with sequence throws synonym
-------------------------------------------------------
Key: HHH-3416
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3416
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.6
Environment: Oracle 10g
Reporter: Libor Tvrdík
I use entity bean without schema with sequence generator.
@Entity
@SequenceGenerator(name = "SEQ_B_ID", sequenceName = "SEQ_B_ID")
class B {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_B_ID")
int id;
}
I need two user, one for insert, and next for select (only select, is for web). In Oracle I have INS schema with table B and WEB schema with synonym B for table B from INS schema.
When I set "hbm2ddl.auto=validate" and run with WEB user catch org.hibernate.HibernateException: Missing sequence or table: SEQ_B_ID
Full Stack:
Nested in org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [spring-database.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Missing sequence or table: SEQ_B_ID:
org.hibernate.HibernateException: Missing sequence or table: SEQ_B_ID
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1100)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:116)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:317)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:814)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:732)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
and more ...
It is important that, without hbm2ddl.auto (no presence, default) everything 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, 5 months
[Hibernate-JIRA] Created: (ANN-749) Generated Annotation can not generate Date automatically
by yuanqingfei (JIRA)
Generated Annotation can not generate Date automatically
--------------------------------------------------------
Key: ANN-749
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-749
Project: Hibernate Annotations
Issue Type: Bug
Affects Versions: 3.4.0.CR1, 3.3.1.GA
Environment: OS: Windows XP
DB: HSQL
Reporter: yuanqingfei
@Before
public void setup() {
order = new Order();
// enter all required fields
order.setName("order1");
order = orderDAO.save(order); //Hibernate should generate a timestamp here
}
@Test
public void testSave() {
assertTrue(orderDAO.exists(order.getId()));
System.out.println(order.getCreateTime()); //here should get a date.
}
Annotation part in Order:
@Temporal(TemporalType.TIMESTAMP)
@Column(insertable = false,updatable=false)
@org.hibernate.annotations.Generated(org.hibernate.annotations.GenerationTime.INSERT)
private Date createTime;
Save part in OrderDAO.
@SuppressWarnings("unchecked")
public T save(T object) {
return (T) super.getHibernateTemplate().merge(object);
}
every time, I just only get null.
--
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, 5 months