[ glamoc @ 12.02.2011. 16:52 ] @
Nikako ne uspevam da entitete koje sam napisao u javi eksportujem u bazu preko Hibernate-a.
Pokusavam preko Ant-a ali kad pokrenem komandu mvn clean install ne javi mi nikakvu gresku ali mi ne eksportuje bazu.

pom.xmp
Code:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.guice.app</groupId>
  <artifactId>guice</artifactId>
  <version>1.0-SNAPSHOT</version>
      <build>
        <finalName>guice</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <inherited>true</inherited>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
            <execution>
                <id>process-classes</id>
                <phase>process-classes</phase>
                <configuration>
                    <tasks>
                        <ant antfile="src/main/ant/build.xml" inheritRefs="true">
                            <target name="schemaexport" />
                            <!-- <target name="hbmexport" /> -->
                        </ant>
                    </tasks>
                </configuration>
                <goals>
                    <!-- <goal>run</goal>-->
                    <goal>run</goal>
                </goals>
            </execution>
        </executions>
         <dependencies>
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-tools</artifactId>
                <version>3.2.0.ga</version>
            </dependency>
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-entitymanager</artifactId>
                <version>3.3.1.ga</version>
            </dependency>
            <dependency>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
                <version>1.2.14</version>
            </dependency>
    </dependencies> 
    </plugin>
        </plugins>        
    </build>
  <packaging>jar</packaging>

  <name>guice</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
 
  <repositories>
       <repository>
            <id>JBoss</id>
            <name>JBoss Repsitory</name>
            <layout>default</layout>
            <url>http://repository.jboss.org/maven2</url>
        </repository>
   </repositories>
  
  <dependencies>
           <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib-nodep</artifactId>
            <version>2.1_3</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate</artifactId>
            <version>3.2.7.ga</version>
            <exclusions>
                <exclusion>
                    <groupId>asm</groupId>
                    <artifactId>asm</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>asm</groupId>
                    <artifactId>asm-attrs</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>cglib</groupId>
                    <artifactId>cglib</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-annotations</artifactId>
            <version>3.4.0.GA</version>
        </dependency>
        
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>3.8.1</version>
          <scope>test</scope>
       </dependency>
       
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-commons-annotations</artifactId>
            <version>3.3.0.ga</version>
        </dependency>
        <dependency>
            <groupId>c3p0</groupId>
            <artifactId>c3p0</artifactId>
            <version>0.9.1.2</version>
        </dependency>
        <dependency>
            <groupId>hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <version>1.8.0.7</version>
        </dependency>                
           <dependency>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
                <version>1.2.13</version>
        </dependency>    
        <dependency>
                <groupId>asm</groupId>
                <artifactId>asm</artifactId>
                <version>3.2</version>
        </dependency>
        
        
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.0.5</version>
        </dependency>
  </dependencies>
</project>


build.xml
Code:

<?xml version="1.0" encoding="UTF-8"?>
<project>
    
    <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpath="maven.compile.classpath"/>
    
    <target name="schemaexport">
        <hibernatetool destdir="target">
            <classpath refid="maven.compile.classpath"/>
            <annotationconfiguration configurationFile="src/main/resources/hibernate.cfg.xml"/>
        
            <hbm2ddl drop="false" create="true" export="false" outputfilename="schema-create.ddl" delimiter=";" format="true"/>
            <hbm2ddl drop="true" create="false" export="false" outputfilename="schema-drop.ddl" delimiter=";" format="true"/>
        </hibernatetool>
    </target>
    
    <target name="hbmexport">
        <hibernatetool destdir="hbm">
            <classpath refid="maven.compile.classpath"/>
            <annotationconfiguration configurationFile="src/main/resources/hibernate.cfg.xml"/>
            <hbm2hbmxml/>
        </hibernatetool>
    </target>
</project>



hibernate.cfg.xml
Code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

    <!-- a SessionFactory instance listed as /jndi/name -->
    <session-factory>

        <property name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
        <property name="use_outer_join">false</property>
        <property name="connection.username">root</property>
        <property name="connection.password"></property>
        <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="connection.url">jdbc:mysql://localhost/guice?createDatabaseIfNotExist=true&amp;useUnicode=true&amp;characterEncoding=utf-8</property>
        <property name="hbm2ddl.auto">update</property>
        
        <!-- Print SQL to stdout, format it nicely  -->
        <property name="show_sql">false</property>
        <property name="format_sql">true</property>
        <property name="use_sql_comments">true</property> 
        
        <!-- C3p0 connection pool properties -->
        <property name="hibernate.c3p0.min_size">2</property>
        <property name="hibernate.c3p0.max_size">10</property>
        <property name="hibernate.c3p0.timeout">300</property>
        <property name="hibernate.c3p0.max_statements">50</property>
        <property name="hibernate.c3p0.idle_test_period">3000</property>
        
        
        <!-- cache provider EHCache 
        <property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
        <property name="hibernate.cache.use_second_level_cache">true</property>
        <property name="hibernate.cache.use_query_cache">true</property>
        -->
        <!-- statistics -->
        <property name="hibernate.generate_statistics">true</property>
        <property name="hibernate.current_session_context_class">thread</property>
        

        <mapping class="beans.User" />

        
    </session-factory>

</hibernate-configuration>


Ako neko vidi u ceu je problem neka javi.
[ _Abraxas @ 13.02.2011. 13:57 ] @
Za pocetak, na kom portu ti je podignut MySQL Server?
Ukoliko je podignut na default portu (3306), onda bi property za putanju do baze trebao da izgleda:
Code:
<property name="connection.url">jdbc:mysql://localhost:3306/guice?createDatabaseIfNotExist=true&amp;useUnicode=true&amp;characterEncoding=utf-8</property>


Medjutim, posto si rekao da nisi dobio nijednu gresku (Hibernate bi prijavio da ne moze da ostvari konekciju, tacnije dataSource bi prijavio), mislim da je problem sto ti ne pokreces projekat. Hibernate ce pokusati da kreira tabele onog trenutka kada se projekat pokrene.

Pozdrav.