Monday, May 27, 2013

How to generate existing entity from existing databases - Symfony, Doctrine

To generate an entity, yes, an entity from a table in an existing database (in YAML):

1. Create a mapping file.

$ app/console doctrine:mapping:convert yml 
./src/Acme/BlogBundle/Resources/config/doctrine/metadata/orm 
--from-database --force --filter=TableName --em=defaultEntityManager

2. Import annotation.
$ app/console doctrine:mapping:import BundleName annotation 
--filter=TableName --em=defaultEntityManager
3. Generate the entity.
$ app/console doctrine:generate:entitie Vendor/BundleName/Entity/EntityName 

Saturday, May 25, 2013

Uncaught TypeError: Object #<Object> has no method 'easeInOutCirc'

This error typically appears when you use Primefaces 3.5. 

I found the answer to this error : http://forum.primefaces.org/viewtopic.php?f=3&t=28427

Basically, just need to add somewhere in your .xhtml file a dummy dialog.

You can add this to your master template file, so that all your other pages will automatically include this dummy dialog. Hope this helps.

Glassfish: Exception while preparing the app : Invalid resource : __pm

I thought I'd like to share this information to anyone who might be having issue with deploying a WAR application on Glassfish Server.

My case is Glassfish 3.1.2 and the error is 
Error occurred during deployment: Exception while preparing the app : Invalid resource : jdbc/login__pm 
It's something to do with glassfish-resources.xml file. If you are deploying a WAR file, it must be a web application, and you need to have glassfish-resources.xml file in your WEB-INF folder.

For other applications, this will be in your META-INF folder.

My glassfish-resources.xml looks like this and this gives me the error  
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN" "http://glassfish.org/dtds/glassfish-resources_1_5.dtd">
<resources>
    <jdbc-connection-pool 
        allow-non-component-callers="false" associate-with-thread="false" 
        connection-creation-retry-attempts="0" 
        connection-creation-retry-interval-in-seconds="10" 
        connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" 
        connection-validation-method="auto-commit" 
        datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" 
        fail-all-connections="false" idle-timeout-in-seconds="300" 
        is-connection-validation-required="false" 
        is-isolation-level-guaranteed="true" 
        lazy-connection-association="false" lazy-connection-enlistment="false" 
        match-connections="false" max-connection-usage-count="0" 
        max-pool-size="128" max-wait-time-in-millis="0" 
        name="java:app/LoginPool" non-transactional-connections="false" 
        pool-resize-quantity="5" 
        res-type="javax.sql.DataSource" statement-timeout-in-seconds="-1" 
        steady-pool-size="10" validate-atmost-once-period-in-seconds="0" 
        wrap-jdbc-objects="false">
        <property name="serverName" value="localhost"/>
        <property name="portNumber" value="3307"/>
        <property name="databaseName" value="clientdb_user"/>
        <property name="User" value="login1"/>
        <property name="Password" value="login1"/>
        <property name="URL" value="jdbc:mysql://localhost:3307/clientdb_user?zeroDateTimeBehavior=convertToNull"/>
        <property name="driverClass" value="com.mysql.jdbc.Driver"/>
        <property name="create" value="true" />
        <property name="connectionAttributes" value=";create=true" />
    </jdbc-connection-pool>
    <jdbc-resource enabled="true" jndi-name="java:app/jdbc/login"
         object-type="user" pool-name="java:app/LoginPool"/>
</resources>