-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: CREATING TABLES
PostPosted: Thu Oct 17, 2013 8:14 am 
Newbie

Joined: Thu Oct 17, 2013 8:07 am
Posts: 3
I using Mysql 5.5. My problem: when i use user different root, i can't create tables. Is mandatory the root user to create tables in hibernate?

Example: grant all privileges to admin. User admin don't create tables.


Top
 Profile  
 
 Post subject: Re: CREATING TABLES
PostPosted: Thu Oct 17, 2013 8:35 am 
Senior
Senior

Joined: Tue Oct 28, 2008 10:39 am
Posts: 196
The user you use must be allowed to create tables. What error do you get?


Top
 Profile  
 
 Post subject: Re: CREATING TABLES
PostPosted: Thu Oct 17, 2013 8:39 am 
Newbie

Joined: Thu Oct 17, 2013 8:07 am
Posts: 3
I used command:
grant select,update,delete,insert,create,alter
on *.* to admin;

Problem: tables aren't created


Top
 Profile  
 
 Post subject: Re: CREATING TABLES
PostPosted: Thu Oct 17, 2013 9:02 am 
Senior
Senior

Joined: Tue Oct 28, 2008 10:39 am
Posts: 196
If *you* use the command that's not a hibernate problem. You can configure Hibernate to create tables (or update table definition) on startup. What error does Hibernate show? What value does "hibernate.hbm2ddl.auto" have?


Top
 Profile  
 
 Post subject: Re: CREATING TABLES
PostPosted: Thu Oct 17, 2013 9:47 am 
Newbie

Joined: Thu Oct 17, 2013 8:07 am
Posts: 3
<?xml version="1.0" encoding="UTF-8"?>
-<beans xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:util="http://www.springframework.org/schema/util" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/beans">
<context:component-scan base-package="com"/>
<context:annotation-config/>
<tx:annotation-driven transaction-manager="transactionManager"/>
<context:property-placeholder location="WEB-INF/classes/jdbc.properties"/>
-<bean destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource" id="dataSource">
<property value="${hibernate.connection.driver_class}" name="driverClassName"/>
<property value="${hibernate.connection.url}" name="url"/>
<property value="${hibernate.connection.username}" name="username"/>
<property value="${hibernate.connection.password}" name="password"/>
<property value="3" name="initialSize"/><property value="60" name="maxActive"/>
<property value="5" name="maxIdle"/><property value="10000" name="maxWait"/>
</bean>-<bean destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource" id="dataSourceConsolidado">
<property value="${hibernate.connection.driver_class}" name="driverClassName"/>
<property value="${hibernate.connection.url.consolidado}" name="url"/>
<property value="${hibernate.connection.username}" name="username"/>
<property value="${hibernate.connection.password}" name="password"/>
<property value="3" name="initialSize"/><property value="60" name="maxActive"/>
<property value="5" name="maxIdle"/><property value="10000" name="maxWait"/>
</bean>-<bean class="org.springframework.orm.hibernate3.HibernateTransactionManager" id="transactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="${hibernate.connection.driver_class}" />
<property name="jdbcUrl" value="${hibernate.connection.url}" />
<property name="properties">
<props> <prop key="c3p0.acquire_increment">5</prop>
<prop key="c3p0.idle_test_period">100</prop>
<prop key="c3p0.max_size">100</prop>
<prop key="c3p0.max_statements">50</prop>
<prop key="c3p0.min_size">10</prop>
<prop key="c3p0.timeout">10</prop>
<prop key="c3p0.acquireRetryAttempts">30</prop>
<prop key="c3p0.idleConnectionTestPeriod">300</prop>
<prop key="c3p0.initialPoolSize">3</prop>
<prop key="c3p0.maxPoolSize">100</prop>
<prop key="c3p0.maxIdleTime">10</prop>
<prop key="c3p0.minPoolSize">10</prop>
<prop key="user">${hibernate.connection.username}</prop>
<prop key="password">${hibernate.connection.password}</prop>
</props>
</property>
</bean> -->

-<bean class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" id="sessionFactory">
-<property name="dataSource"><ref bean="dataSource"/>
</property><property value="WEB-INF/classes/hibernate.cfg.xml" name="configLocation"/>
<property value="org.hibernate.cfg.AnnotationConfiguration" name="configurationClass"/>
-<property name="hibernateProperties">
-<props>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.dialect"> ${hibernate.dialect} </prop>
<prop key="hibernate.show_sql">false</prop>
</props>
</property>
</bean>

-<bean class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" id="sessionFactoryConsolidado">
-<property name="dataSource">
<ref bean="dataSourceConsolidado"/>
</property><property value="WEB-INF/classes/hibernate.cfg.consolidado.xml" name="configLocation"/>
<property value="org.hibernate.cfg.AnnotationConfiguration" name="configurationClass"/>
-<property name="hibernateProperties">
-<props><prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.dialect"> ${hibernate.dialect} </prop>
<prop key="hibernate.show_sql">false</prop>
</props></property></bean><bean class="com.dataaprev.webservice.ApplicationContextProvider" id="contextApplicationContextProvider"/>-<bean class="org.springframework.orm.hibernate3.HibernateInterceptor" id="hibernateInterceptor">-<property name="sessionFactory"><ref bean="sessionFactory"/></property></bean>
-<bean class="com.dataaprev.struts.dao.ajax.ParticipantesAjax" id="ParticipantesAjax"><property name="sessionFactory" ref="sessionFactory"/><property name="participantesJDBC" ref="ParticipantesJDBC"/></bean>-<bean class="com.dataaprev.struts.dao.jdbc.PopulateDefault" id="PopulateDefault"><property name="sessionFactory" ref="sessionFactory"/></bean>-<bean class="com.dataaprev.struts.dao.jdbc.PopulaDadosPlano" id="PopulaDadosPlano"><property name="sessionFactory" ref="sessionFactory"/></bean></beans>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.