My config file is:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd" >
<generatorConfiguration >
<context id="context1" >
<jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver" connectionURL="jdbc:oracle:thin:#localhost:1521:xe" userId="system" password="system" ></jdbcConnection>
<javaModelGenerator targetPackage="pl.domain.model" targetProject="mailsender2" />
<sqlMapGenerator targetPackage="pl.domain.model" targetProject="mailsender2" ></sqlMapGenerator>
<javaClientGenerator targetPackage="???" targetProject="???" type="XMLMAPPER" />
<table schema="SYSTEM" tableName="user" domainObjectName="User" enableSelectByExample="false" enableDeleteByExample="false"
enableCountByExample="false" enableUpdateByExample="false" >
</table>
</context>
</generatorConfiguration>
How can I generate only simple select/update/insert/delete SQLs? whitout this below?
Mapper.xml
<insert id="insertSelective" parameterType="pl.domain.model.User" >
<!--
WARNING - #mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Apr 14 13:40:15 CEST 2011.
-->
insert into SYSTEM.USER
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="userId != null" >
USER_ID,
</if>
<if test="created != null" >
CREATED,
</if>
<if test="firstName != null" >
FIRST_NAME,
</if>
<if test="hash != null" >
HASH,
</if>
<if test="language != null" >
LANGUAGE,
</if>
<if test="lastName != null" >
LAST_NAME,
For supressing the comments, did you try this :
<commentGenerator>
<property name="suppressAllComments" value="true" />
</commentGenerator>
Also did you try this:
<table tableName="your_table_name_here" domainObjectName="domain_bject_name_here" enableSelectByExample="false" enableDeleteByExample="false" enableCountByExample="false" enableUpdateByExample="false" selectByExampleQueryId="false" selectByPrimaryKeyQueryId="false" modelType="flat">
</table>
Related
return $this->entityManager
->createQueryBuilder()
->select('cac.fkClient', 'cac.fkIndividualConsultation', 'cac.dateAdded', 'cac.fkWorker')
->from(ClientActivityIndividualConsultationHistory::class, 'cac')
->where('cac.dateAdded BETWEEN :startDate AND :endDate')
->andWhere('cac . fkWorker = :workerId')
->setParameters([
'startDate' => $dateStart,
'dateEnd' => $dateEnd,
'workerId' => $workerId
])
->getQuery()
->getArrayResult();
Error message:
[Semantical Error] line 0, col 11 near 'fkClient,
cac.fkIndividualConsultation,': Error: Invalid PathExpression. Must be
a StateFieldPathExpression.
ORM:
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Sepc\Bundle\WebBundle\Entity\ClientActivityIndividualConsultationHistory"
table="client_activity_individual_consultation_history">
<indexes>
<index name="fk_client_activity_individual_consulation_history_worker_id" columns="fk_worker_id"/>
<index name="fk_client_activity_individual_consulation_history_client_id" columns="fk_client_id"/>
<index name="fk_client_individual_consulation_history_consultation_id"
columns="fk_individual_consultation_id"/>
</indexes>
<id name="id" type="integer" column="id">
<generator strategy="IDENTITY"/>
</id>
<field name="dateAdded" type="datetime" column="date_added" nullable="false">
<options>
<option name="default">CURRENT_TIMESTAMP</option>
</options>
</field>
<many-to-one field="fkClient" target-entity="Client" fetch="LAZY">
<join-columns>
<join-column name="fk_client_id" referenced-column-name="id"/>
</join-columns>
</many-to-one>
<many-to-one field="fkWorker" target-entity="Worker" fetch="LAZY">
<join-columns>
<join-column name="fk_worker_id" referenced-column-name="id"/>
</join-columns>
</many-to-one>
<many-to-one field="fkIndividualConsultation" target-entity="CalendarIndividualConsultation" fetch="LAZY">
<join-columns>
<join-column name="fk_individual_consultation_id" referenced-column-name="id"/>
</join-columns>
</many-to-one>
</entity>
</doctrine-mapping>
I tried everything ( stackoverflow, google, own expierences ) but I really don't know where can be problem. Can somebody explain me this error or navigate me to right way? Thanks.
I do not want to use IDENTITY function because I need all data asociated with foreign keys. ( Doctrine automatically select these objects and I think that this can generate error, but why? )
Using: Symfony FW, Doctrine 2 ORM, MySQL
My tips:
Bad ORM generated files
QueryBuilder bug
You should join with the fkClient, fkIndividualConsultation and fkWorker relations in order to select them.
So change to:
->select('cac')
->from(ClientActivityIndividualConsultationHistory::class, 'cac')
->leftJoin('cac.fkIndividualConsultation', 'fkIndividualC')
->leftJoin('cac.fkClient', 'fkClient')
->leftJoin('cac.fkWorker', 'fkWorker')
return $this->entityManager
->createQueryBuilder()
->select('cac')
->distinct('cac.fkClient')
->from(ClientActivityIndividualConsultationHistory::class, 'cac')
->where('cac.dateAdded BETWEEN :startDate AND :endDate')
->andWhere('cac . fkWorker = :workerId')
->setParameters([
'startDate' => $dateStart,
'endDate' => $dateEnd,
'workerId' => $workerId
])
->getQuery()
->getResult();
Fixed.
Use getResult() function instead if getArrayResult();
Thanks all.
you can user select statement as follows:
SELECT IDENTITY(c.parent) ...
it will return the ids and then you can hydrate it with object in getResult() method as follows:
->getResult(AbstractQuery::HYDRATE_OBJECT);
I have duplicate entry in my xml column in my sql table see material8 key.I remove one entry.I am trying below query its removing both.Is there any way i can remove only one entry.
Update mytable set xml = replace (xml, "<Book key=\"material8\" active=\"true\" displayOrder=\"5\" />", "") where id = 9 and type_key="mykey1";
<?xml version="1.0" encoding="UTF-8"?>
<Type key="test1" publicKey="test2" >
<UIProperties>
<label locale="en_US">My book</label>
</UIProperties>
<Books>
<Book key="material1" active="true" displayOrder="0" >
<UIProperties>
<label locale="en_US">My Books</label>
</UIProperties>
</Book>
<Book key="material2" />
<Book key="material3" active="true" displayOrder="3" >
<Pages>
<Page key="material4" active="true" displayOrder="0" />
<Page key="material5" active="true" displayOrder="1" />
</Pages>
</Book>
<Book key="material6" active="true" displayOrder="4" />
<Book key="material7" active="true" displayOrder="2" />
<Book key="material8" active="true" displayOrder="5" />
<Book key="material8" active="true" displayOrder="5" />
</Books>
<Attributes>
<Attribute key="desc" />
<Attribute key="date1" />
<Attribute key="date2" />
</Attributes>
</Type>
A simple solution is to replace 2 books to 1, instead of 1 to none:
UPDATE mytable
SET xml = REPLACE(xml, "<Book key=\"material8\" active=\"true\" displayOrder=\"5\" /><Book key=\"material8\" active=\"true\" displayOrder=\"5\" />", "<Book key=\"material8\" active=\"true\" displayOrder=\"5\" />")
WHERE id = 9
AND type_key="mykey1";
My aim is to log a JSON object value fethed from a jsp file from the vxml. Is there any way to do that. I see that there is a function called JSON.stringify but thats giving me nothing as a log.
Below is my code:
<?xml version="1.0"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
<var name="userId" expr="1" />
<!--form id="get_location"-->
<data name="userData" method="get" src="http://localhost:5000/userLocation.jsp" nameList="userId" />
<property name="inputmodes" value="dtmf"/>
<menu id="menuZero">
<choice dtmf="1" next="#choice1"/>
<choice dtmf="2" next="#choice2"/>
</menu>
<!--/form-->
<form id="choice1">
<block>
<if cond="userData.HttpResponse.do_queryResponse['return'].errorMsg.result_code != '0'">
<goto next="welcome.vxml"/>
<else/>
<goto next="welcome.vxml"/>
</if>
</block>
</form>
<form id="choice2">
<block>
<log expr="JSON.stringify(userData.HttpResponse)"/>
</block>
</form>
</vxml>
Maybe, VoiceXML is not supported "JSON.stringify".
Try to get "json2.js" and add code.
<script src="json2.js" />
For example,
<?xml version="1.0" encoding="UTF-8"?>
<vxml
version="2.0"
xmlns="http://www.w3.org/2001/vxml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<script src="json2.js" />
<var name="messageObject" expr="{keyA:'valueA',keyB:'valueB',keyC:'valueC'}" />
<form>
<block><prompt>Write Log!</prompt></block>
<block><log expr="JSON.stringify(messageObject)"/></block>
</form>
</vxml>
I tested this code on "Voxeo Prophecy 13".
I tried json2.js as described above and I had the same issue, 'assignment to undeclared variable JSON'. To fix this, I just declared in the same file (json2.js):
var JSON;
Then it worked properly. In the vxml:
<script><![CDATA[
prueba = new Object();
prueba.pepito = 1234;
prueba.OtraPrueba = "lalalapepe";
]]></script>
<log label="IVB_HISTORY">
<value expr="JSON.stringify(prueba)"/>
</log>
It gets logged as followed:
{"pepito":1234,"OtraPrueba":"lalalapepe"}
I'm using Convergy's InVision Studio
I want to use two exceptions.
the first:
The user can say (every time, in the whole application) "stop" and then the program exits.
the second:
I have following Code:
<form id="test">
<field name="test1">
<prompt bargein="true" bargeintype="hotword" > choose xy</prompt>
<grammar root="main" version="1.0" xml:lang="de-DE">
<rule id="main" scope="public">
<one-of>
<item>1</item>
<item>2</item>
<item>3</item>
</one-of>
</rule>
</grammar>
<nomatch>
didn't get it
<reprompt/>
</nomatch>
<noinput>
didn't hear you ?
<reprompt/>
</noinput>
<filled>
<assign name="myvar" expr="test1" />
<value expr="myvar"/> chosen
</filled>
</field>
</form>
I want that the user can say a word of my choice, and then a help-exception triggers - like
choose the following: x,y,z,...
how can i use such a exception handler?
thanks
I solved it like this:
I added an item:
<item>help</item>
and checked if the item was chosen:
<filled>
<if cond="test1 == 'help'">
<prompt>say xy.</prompt>
<goto next="#test" />
</if>
<assign name="myvar" expr="test1" />
<value expr="myZeitraum"/> chosen.
<goto next="#KPI" />
</filled>
I am attempting to experiment with linq to sql using this site as a guide.
When running a test I keep getting an error parsing the mapping file I created. The error:
System.Xml.Schema.XmlSchemaException : Database node not found. Is the mapping namespace (http://schemas.microsoft.com/linqtosql/mapping/2007) correctly specified?
Here is the mapping file:
<?xml version="1.0" encoding="utf-8"?>
<Database Name="Test" xmlns="http://schemas.microsoft.com/linqtosql/mapping/2007">
<Table Name="dbo.Categories" Member="Category">
<Type Name="Category">
<Column Name="ID" Member="ID" Storage="id" DbType="Char(32) NOT NULL" CanBeNull="false" IsPrimaryKey="true" />
<Column Name="ParentID" Member="ParentID" Storage="parentID" DbType="Char(32)" />
<Column Name="Name" Member="Name" Storage="name" DbType="VarChar(50) NOT NULL" CanBeNull="false" />
</Type>
</Table>
</Database>
Can anyone point me in the right direction?
Figured it out!
the line:
<Table Name="dbo.Categories" Member="Category">
Needed changed to:
<Table Name="dbo.Categories" Member="Categories">
and now its working.