Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Mahidhar kundella
Service Builder is not creating the tables in Mysql
March 11, 2013 10:23 PM
Answer

Mahidhar kundella

Rank: New Member

Posts: 10

Join Date: January 28, 2013

Recent Posts

Hi

Here I'm creating extra user table to add some extra fields and I created one service.xml file with proper fields when I'm trying to run the "Build Services" option all the java classes are creating but table is not creating in the Mysql database.

When I see the liferay generate tables.sql file it has the following

create table wsc_UserType (
userTypeId LONG not null primary key,
siteurl VARCHAR(75) null,
companyName VARCHAR(75) null,
supportBrands VARCHAR(75) null,
services VARCHAR(75) null,
servicesByAreas VARCHAR(75) null,
createdDate DATE null,
modifiedDate DATE null
);

I tried to create table manually in Mysql Its giving the following error

"ERROR 1170 (42000): BLOB/TEXT column 'userTypeId' used in key specification without a key length"

Please suggest me what is the issue here

I'm using liferay-portal-6.1.0 and mysql-5.5.29-winx64.msi

Thanks in Advance,
Mahidhar Kundella
Apoorva Prakash
RE: Service Builder is not creating the tables in Mysql
March 11, 2013 10:37 PM
Answer

Apoorva Prakash

Rank: Liferay Master

Posts: 659

Join Date: June 15, 2010

Recent Posts

Mahidhar kundella:
Hi

Here I'm creating extra user table to add some extra fields and I created one service.xml file with proper fields when I'm trying to run the "Build Services" option all the java classes are creating but table is not creating in the Mysql database.

When I see the liferay generate tables.sql file it has the following

create table wsc_UserType (
userTypeId LONG not null primary key,
siteurl VARCHAR(75) null,
companyName VARCHAR(75) null,
supportBrands VARCHAR(75) null,
services VARCHAR(75) null,
servicesByAreas VARCHAR(75) null,
createdDate DATE null,
modifiedDate DATE null
);

I tried to create table manually in Mysql Its giving the following error

"ERROR 1170 (42000): BLOB/TEXT column 'userTypeId' used in key specification without a key length"

Please suggest me what is the issue here

I'm using liferay-portal-6.1.0 and mysql-5.5.29-winx64.msi

Thanks in Advance,
Mahidhar Kundella


HI Mahidhar,

Have a look on this post.

Provide your service.xml file also.

Thanks and Regards,
Apoorva Prakash
Mahidhar kundella
RE: Service Builder is not creating the tables in Mysql
March 11, 2013 10:36 PM
Answer

Mahidhar kundella

Rank: New Member

Posts: 10

Join Date: January 28, 2013

Recent Posts

Prakash,
my service.xml file is
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.1.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_1_0.dtd">
<service-builder package-path="com.user.registration">
<author>Mahidhar</author>
<namespace>test</namespace>

<entity name="UserType" local-service="true" remote-service="false">
<!-- PK fields -->

<column name="userTypeId" type="long" primary="true" />

<!-- UI fields -->

<column name="siteurl" type="String" />
<column name="companyName" type="String" />
<column name="supportBrands" type="String" />
<column name="services" type="String" />
<column name="servicesByAreas" type="String" />

<!-- Audit fields -->

<column name="createdDate" type="Date" />

<column name="modifiedDate" type="Date" />

<finder name="userTypes" return-type="Collection">
<finder-column name="siteurl"></finder-column>
</finder>

</entity>
</service-builder>
Mahidhar kundella
RE: Service Builder is not creating the tables in Mysql
March 11, 2013 10:42 PM
Answer

Mahidhar kundella

Rank: New Member

Posts: 10

Join Date: January 28, 2013

Recent Posts

Prakash find my service.xml file in attachments
Attachments: service.xml (1.0k)
Apoorva Prakash
RE: Service Builder is not creating the tables in Mysql
March 11, 2013 11:35 PM
Answer

Apoorva Prakash

Rank: Liferay Master

Posts: 659

Join Date: June 15, 2010

Recent Posts

Mahidhar kundella:
Prakash find my service.xml file in attachments


Service.xml looks fine...

have you tries the following change in table XML:

1userTypeId bigint not null primary key


Hope this will help...

Thanks and Regards,
Apoorva Prakash
Mahidhar kundella
RE: Service Builder is not creating the tables in Mysql
March 11, 2013 11:42 PM
Answer

Mahidhar kundella

Rank: New Member

Posts: 10

Join Date: January 28, 2013

Recent Posts

If I run the query manually its working with your changes but in the service.xml file what should be the type do I put

Thanks & Regards,
Mahidhar
Manish Yadav
RE: Service Builder is not creating the tables in Mysql
March 11, 2013 11:56 PM
Answer

Manish Yadav

Rank: Expert

Posts: 385

Join Date: May 26, 2012

Recent Posts

if you deploy portlet in liferay server tables will automatically create in mysql.
you can't use .sql file directly .its generic sql file .liferay will convert this sql file according to database while deployment of portlet .

If you want to create table manually then write mysql create table syntax instead of copy paste of liferay .sql file.
There is no need to change anything in service.xml.
Apoorva Prakash
RE: Service Builder is not creating the tables in Mysql
March 12, 2013 12:02 AM
Answer

Apoorva Prakash

Rank: Liferay Master

Posts: 659

Join Date: June 15, 2010

Recent Posts

Mahidhar kundella:
If I run the query manually its working with your changes but in the service.xml file what should be the type do I put

Thanks & Regards,
Mahidhar



Mahidhar, do the following:

1. keep the same service.xml, but change only the in the .sql file.
2. create War and try deploying.

It did worked for me, when I has this problem.

Thanks and Regards,
Apoorva Prakash