2013-05-13 2 views
0

데이터베이스에 내 개체를 유지하려고 시도하고 the ORA-01861: literal does not match format string 오류가 발생합니다. 나는이 메시지로 인도하는 날짜와 문자열의 변환 사이의 오류가 대부분 있음을 안다. 그것은 나에게도 해당 될 수 있지만 그 이유를 알 수는 없습니다. 여기 (프로파일 러)에서 SQL 문은 다음과 같습니다ORA-01861 : DateTime을 사용하는 동안 literal이 형식 문자열과 일치하지 않습니다.

INSERT INTO Person (no_person, first_name, usual_name, last_name, 
birth_date, comments, c_user_creation, date_creation, c_user_modification, 
date_modification, email, id_rh, cod_civ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 
?, ?) Parameters: { 1: '173704', 2: Test, 3: 'null', 4: Test, 5: Object(DateTime), 6: 'null', 
7: Web, 8: Object(DateTime), 9: 'null', 10: 'null', 11: [email protected], 12: 'null', 13: '1'} 
Time: 0.00 ms 

사람 엔티티 :

<?php 

namespace my\myBundle\Entity; 

use Doctrine\ORM\Mapping as ORM; 
use Symfony\Component\HttpFoundation\File\UploadedFile; 

/** 
* my\myBundle\Entity\Person 
* 
* @ORM\Table(name="Person") 
* @ORM\Entity(repositoryClass="my\myBundle\Entity\PersonRepository") 
*/ 
class Person 
{ 
/** 
* 
* @ORM\Id 
* @ORM\GeneratedValue(strategy="SEQUENCE") 
* @ORM\Column(name="no_Person", type="integer") 
* @ORM\SequenceGenerator(sequenceName="SEQ_NO_Person") 
*/ 
public $noPerson; 

/** 
* 
* @ORM\ManyToOne(targetEntity="civility") 
* @ORM\JoinColumn(name="cod_civ", referencedColumnName="cod_civ") 
*/ 
private $civility; 

/** 
* @var string $firstName 
* 
* @ORM\Column(name="first_name", type="string", length=30) 
*/ 
private $firstName; 

/** 
* @var string $usualName 
* 
* @ORM\Column(name="usual_name", type="string", length=30) 
*/ 
private $usualName; 

/** 
* @var string $lastName 
* 
* @ORM\Column(name="last_name", type="string", length=20) 
*/ 
private $lastName; 

/** 
* @var date $birthDate 
* 
* @ORM\Column(name="birth_date", type="date") 
*/ 
private $birthDate; 

/** 
* @var string $comment 
* 
* @ORM\Column(name="comment", type="string", length=300) 
*/ 
private $comment; 

/** 
* @var string $cUserCreation 
* 
* @ORM\Column(name="c_user_creation", type="string", length=30) 
*/ 
private $cUserCreation; 

/** 
* @var date $dCreation 
* 
* @ORM\Column(name="date_creation", type="date") 
*/  
private $dCreation; 

/** 
* @var string $cUserModification 
* 
* @ORM\Column(name="c_user_modification", type="string", length=30) 
*/ 
private $cUserModification; 

/** 
* @var date $dModification 
* 
* @ORM\Column(name="date_modification", type="date") 
*/  
private $dModification; 

/** 
* @var string $email 
* 
* @ORM\Column(name="email", type="string", length=100) 
*/ 
private $email; 

/** 
* @var integer $idRh 
* 
* @ORM\Column(name="id_rh", type="integer") 
*/ 
private $idRh; 

/** 
* @var \Doctrine\Common\Collections\ArrayCollection $accCip 
* 
* @ORM\OneToMany(targetEntity="my\myBundle\Entity\AccCip",mappedBy="Person") 
*/ 

private $accCip; 


/** 
* @var \Doctrine\Common\Collections\ArrayCollection $cartes 
* 
* @ORM\OneToMany(targetEntity="my\myBundle\Entity\Carte",mappedBy="Person") 
*/ 

private $cartes; 

/** 
* @var \Doctrine\Common\Collections\ArrayCollection $panier 
* 
* @ORM\OneToMany(targetEntity="my\myBundle\Entity\Panier",mappedBy="Person") 
*/ 

private $panier; 

/** 
* @var \Doctrine\Common\Collections\ArrayCollection $transactions 
* 
* @ORM\OneToMany(targetEntity="my\myBundle\Entity\TransactionPaybox",mappedBy="Person") 
*/ 

private $transactions; 

/** 
* @var my\myBundle\Entity\Adresse $adresses 
* 
* @ORM\OneToMany(targetEntity="my\myBundle\Entity\Adresse",mappedBy="Person",cascade={"persist"}) 
*/ 
private $adresses; 

public function __construct() 
{ 
    $this->cUserCreation = "Web"; 
    $this->dCreation = new \DateTime(); 
    $this->birthDate = new \DateTime(); 
    $this->cartes = new \Doctrine\Common\Collections\ArrayCollection(); 
    $this->accCip = new \Doctrine\Common\Collections\ArrayCollection(); 
    $this->panier = new \Doctrine\Common\Collections\ArrayCollection(); 
    $this->transactions = new \Doctrine\Common\Collections\ArrayCollection(); 
    $this->insActSpos = new \Doctrine\Common\Collections\ArrayCollection(); 
    $this->adresses = new \Doctrine\Common\Collections\ArrayCollection(); 
} 

/** 
* Get noPerson 
* 
* @return integer 
*/ 
public function getNoPerson() 
{ 
    return $this->noPerson; 
} 

/** 
* Set firstName 
* 
* @param string $firstName 
*/ 
public function setfirstName($firstName) 
{ 
    $this->firstName = $firstName; 
} 

/** 
* Get firstName 
* 
* @return string 
*/ 
public function getfirstName() 
{ 
    return $this->firstName; 
} 

/** 
* Set usualName 
* 
* @param string $usualName 
*/ 
public function setusualName($usualName) 
{ 
    $this->usualName = $usualName; 
} 

/** 
* Get usualName 
* 
* @return string 
*/ 
public function getusualName() 
{ 
    return $this->usualName; 
} 

/** 
* Set lastName 
* 
* @param string $lastName 
*/ 
public function setlastName($lastName) 
{ 
    $this->lastName = $lastName; 
} 

/** 
* Get lastName 
* 
* @return string 
*/ 
public function getlastName() 
{ 
    return $this->lastName; 
} 

/** 
* Set birthDate 
* 
* @param string $birthDate 
*/ 
public function setbirthDate(\DateTime $birthDate) 
{ 
    $this->birthDate = clone $birthDate; 
} 

/** 
* Get birthDate 
* 
* @return string 
*/ 
public function getbirthDate() 
{ 
    return $this->birthDate; 
} 

/** 
* Set comment 
* 
* @param string $comment 
*/ 
public function setcomment($comment) 
{ 
    $this->comment = $comment; 
} 

/** 
* Get comment 
* 
* @return string 
*/ 
public function getcomment() 
{ 
    return $this->comment; 
} 

/** 
* Set cUserCreation 
* 
* @param string $cUserCreation 
*/ 
public function setCUserCreation($cUserCreation) 
{ 
    $this->cUserCreation = $cUserCreation; 
} 

/** 
* Get cUserCreation 
* 
* @return string 
*/ 
public function getCUserCreation() 
{ 
    return $this->cUserCreation; 
} 

/** 
* Set dCreation 
* 
* @param string $dCreation 
*/ 
public function setDCreation(\DateTime $dCreation) 
{ 
    $this->dCreation = clone $dCreation; 
} 

/** 
* Get dCreation 
* 
* @return string 
*/ 
public function getDCreation() 
{ 
    return $this->dCreation; 
} 

/** 
* Set cUserModification 
* 
* @param string $cUserModification 
*/ 
public function setCUserModification($cUserModification) 
{ 
    $this->cUserModification = $cUserModification; 
} 

/** 
* Get cUserModification 
* 
* @return string 
*/ 
public function getCUserModification() 
{ 
    return $this->cUserModification; 
} 

/** 
* Set dModification 
* 
* @param string $dModification 
*/ 
public function setDModification(\DateTime $dModification) 
{ 
    $this->dModification = clone $dModification; 
} 

/** 
* Get dModification 
* 
* @return string 
*/ 
public function getDModification() 
{ 
    return $this->dModification; 
} 

/** 
* Set email 
* 
* @param string $email 
*/ 
public function setEmail($email) 
{ 
    $this->email = $email; 
} 

/** 
* Get email 
* 
* @return string 
*/ 
public function getEmail() 
{ 
    return $this->email; 
} 

/** 
* Set idRh 
* 
* @param integer $idRh 
*/ 
public function setIdRh($idRh) 
{ 
    $this->idRh = $idRh; 
} 

/** 
* Get idRh 
* 
* @return integer 
*/ 
public function getIdRh() 
{ 
    return $this->idRh; 
} 

/** 
* Set civility 
* 
* @param my\myBundle\Entity\civility $civility 
*/ 
public function setcivility(\my\myBundle\Entity\civility $civility) 
{ 
    $this->civility = $civility; 
} 

/** 
* Get civility 
* 
* @return my\myBundle\Entity\civility 
*/ 
public function getcivility() 
{ 
    return $this->civility; 
} 

/** 
* Get accCip 
* 
* @return \Doctrine\Common\Collections\ArrayCollection; 
* 
*/ 
public function getAccCip(){ 
    return $this->accCip; 
} 

/** 
* Add accCip 
* 
* @param AccCip $accCip; 
* 
* @return Person 
* 
*/ 

    public function addAccCip(AccCip $accCip) 
    { 
    $this->accCip[] = $accCip; 
    $accCip->setPerson($this); 
    return $this; 
    } 

    /** 
    * Remove accCip 
    * 
    * @param AccCip $accCip; 
    * 
    * 
    */ 

    public function removeAccCip(AccCip $accCip) 
    { 
    $this->accCip->removeElement($accCip); 
    } 

    /** 
    * Get cartes 
    * 
    * @return \Doctrine\Common\Collections\ArrayCollection 
    * 
    */ 
    public function getCartes(){ 
    return $this->cartes; 
    } 

    /** 
    * Add carte 
    * 
    * @param Carte $carte; 
    * 
    * @return Person 
    * 
    */ 

    public function addCarte(Carte $carte) 
    { 
    $this->cartes[] = $carte; 
    $carte->setPerson($this); 
    return $this; 
    } 

    /** 
    * Remove carte 
    * 
    * @param Carte $carte; 
    * 
    * 
    */ 

    public function removeCarte(Carte $carte) 
    { 
    $this->cartes->removeElement($carte); 
    } 

    /** 
    * Has carte 
    * 
    * @return boolean 
    * 
    */ 

    public function hasCarte() 
    { 
    return $this->cartes->count()!=0; 
    } 

    /** 
    * Get panier 
    * 
    * @return \Doctrine\Common\Collections\ArrayCollection 
    * 
    */ 
    public function getPanier(){ 
    return $this->panier; 
    } 

    /** 
    * Add panier 
    * 
    * @param Panier $panier; 
    * 
    * @return Person 
    * 
    */ 

    public function addPanier(Panier $panier) 
    { 
    $this->panier[] = $panier; 
    $panier->setPerson($this); 
    return $this; 
    } 

    /** 
    * Remove panier 
    * 
    * @param Panier $panier; 
    * 
    * 
    */ 

    public function removePanier(Panier $panier) 
    { 
    $this->panier->removeElement($panier); 
    } 

    /** 
    * Get Somme Panier 
    * 
    * @return float 
    * 
    */ 

    public function getSommePanier() 
    { 
    $somme=0; 
    foreach ($this->panier as $item){ 
     $somme+=$item->getMontant(); 
    } 
    return $somme; 
    } 

    /** 
    * Get transactions 
    * 
    * @return \Doctrine\Common\Collections\ArrayCollection 
    * 
    */ 
    public function getTransactions(){ 
    return $this->transactions; 
    } 

    /** 
    * Add transaction 
    * 
    * @param TransactionPaybox $transaction; 
    * 
    * @return Person 
    * 
    */ 

    public function addTransaction(TransactionPaybox $transaction) 
    { 
    $this->transactions[] = $transaction; 
    $transaction->setPerson($this); 
    return $this; 
    } 

    /** 
    * Remove transaction 
    * 
    * @param TransactionPaybox $transaction; 
    * 
    * 
    */ 

    public function removeTransaction(TransactionPaybox $transaction) 
    { 
    $this->transactions->removeElement($transaction); 
    } 

    /** 
    * Get adresses 
    * 
    * @return \Doctrine\Common\Collections\ArrayCollection 
    * 
    */ 
    public function getAdresses(){ 
    return $this->adresses; 
    } 


    /** 
    * Add Adresse 
    * 
    * @param my\myBundle\Entity\Adresse $adresse; 
    * 
    * @return Person 
    * 
    */ 

    public function addAdresse(Adresse $adresse) 
    { 
    $this->adresses[] = $adresse; 
    $adresse->setPerson($this); 
    return $this; 
    } 

    /** 
    * Remove adresses 
    * 
    * @param my\myBundle\Entity\Adresse $adresse; 
    * 
    * 
    */ 

    public function removeAdresse(Adresse $adresse) 
    { 
    $this->adresses->removeElement($adresse); 
    } 

}

SQL :

CREATE TABLE "MYDB"."PERSON" 
( "NO_PERSON" NUMBER(8,0), 
"COD_CIV" VARCHAR2(1 BYTE), 
"FIRST_NAME" VARCHAR2(30 BYTE), 
"USUAL_NAME" VARCHAR2(30 BYTE), 
"LAST_NAME" VARCHAR2(20 BYTE), 
"BIRTH_DATE" DATE, 
"COMMENT" VARCHAR2(300 BYTE), 
"C_USER_CREATION" VARCHAR2(30 BYTE), 
"DATE_CREATION" DATE, 
"C_USER_MODIFICATION" VARCHAR2(30 BYTE), 
"DATE_MODIFICATION" DATE, 
"EMAIL" VARCHAR2(100 BYTE), 
"ID_RH" NUMBER(8,0), 
) 

편집 : 좀 더 정보. 나는 이전 버전에서 "문자열"이었기 때문에 (현재로서는 개발자가 아니 었습니다.) doctrine이 엔티티를 만들려고하면이 예외가 throw됩니다 :

데이터베이스에

날짜는 실제로 "날짜"SQL의 유형이처럼 값 목록의 날짜에 대한 각각의 열을 수정하면 아마

+0

당신은 우리에게 SQL 테이블 구조를 보여줄 수 있습니까? – Mithrand1r

+0

SQL 테이블 구조를 추가했습니다. – MisterJ

답변

0

:.

TO_DATE (?, 'Y-m_d 0시 : 00 ')

나는 이것에 대해 정말로 확신하지 못한다. 모자가 내 마음에 들었다.

관련 문제