im getting this error while trying to insert an entity in symfony2 with doctrine2,
/**
* Moneda
*
* @ORM\Table(name="moneda")
* @ORM\Entity
*/
class Moneda
{
/**
* @var integer
*
* @ORM\Column(name="moneda_id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="SEQUENCE")
* @ORM\SequenceGenerator(sequenceName="moneda_moneda_id_seq", allocationSize=1,initialValue=1)
*/
private $monedaId;
I`ve check my database to check any typo erros but everything is in order so i don´t know what is wrong here so please any help will be appreciated.
this is the exception
An exception occurred while executing 'SELECT NEXTVAL('moneda_moneda_id_seq')':
SQLSTATE[42P01]: Undefined table: 7 ERROR: no existe la relación «moneda_moneda_id_seq» LINE 1: SELECT NEXTVAL('moneda_moneda_id_seq')
I have had the same issue before. You must include the schema name while referring to the sequence. So try using something like this when defining your sequence:
@ORM\SequenceGenerator(sequenceName="schema_name.moneda_moneda_id_seq", allocationSize=1,initialValue=1)
This is what solved my issue. Hopefully it will work for you as well.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.