Problem with sql - java.sql.SQLException: Operand should contain 1 column(s) (oncePassing empty list as parameter to JPA query throws errorHow can I SELECT rows with MAX(Column value), DISTINCT by another column in SQL?SQL select only rows with max value on a columnstatement . executeUpdate gives date truncated for column X at row 1 errorHibernate + spring-data: WrongClassException - object with id was not of the specified subclassfindByUuid() doesn't work in MySQL-DB when using HibernateHibernate NPE when using function() to call native sql method within jpaContinuous server request causing issue of hibernate exception unsafe use of sessionHibernate DefaultEntityAliases raises NullPointerExceptionCannot connect to MySQL on localhost using JDBC DriverUnable to create a table automatically and insert records using spring and hibernate integration

Crowbar circuit causes unexpected behavior for op amp circuit

Referring to different instances of the same character in time travel

What did indigenous North Americans trade amongst themselves before Europeans arrived?

(async () => )(); what is this?

Grammy Winners Grading

What is the Precise Definition of a “Complex Vector Space”?

Credit union holding car note, refuses to provide details of how payments have been applied

QGIS Welcome page: What is 'pin to list' for?

Trying to find a flaw in my proof that there are more rearrangements of an infinite series than real numbers

A DVR algebra with weird automorphisms

The monorail explodes before I can get on it

Why does Hellboy file down his horns?

How might the United Kingdom become a republic?

During copyediting, journal disagrees about spelling of paper's main topic

How to check the quality of an audio sample?

How can an advanced civilization forget how to manufacture its technology?

Optimising Table wrapping over a Select

Can I intentionally omit previous work experience or pretend it doesn't exist when applying for jobs?

Would letting a multiclass character rebuild their character to be single-classed be game-breaking?

Am I testing diodes properly?

I quit, and boss offered me 3 month "grace period" where I could still come back

How can one write good dialogue in a story without sounding wooden?

How did the Game Boy Advance stretch Game Boy games to widescreen?

Why isn't there research to build a standard lunar, or Martian mobility platform?



Problem with sql - java.sql.SQLException: Operand should contain 1 column(s) (once


Passing empty list as parameter to JPA query throws errorHow can I SELECT rows with MAX(Column value), DISTINCT by another column in SQL?SQL select only rows with max value on a columnstatement . executeUpdate gives date truncated for column X at row 1 errorHibernate + spring-data: WrongClassException - object with id was not of the specified subclassfindByUuid() doesn't work in MySQL-DB when using HibernateHibernate NPE when using function() to call native sql method within jpaContinuous server request causing issue of hibernate exception unsafe use of sessionHibernate DefaultEntityAliases raises NullPointerExceptionCannot connect to MySQL on localhost using JDBC DriverUnable to create a table automatically and insert records using spring and hibernate integration






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I'm using Spring Data for select operation on MySql DataBase.



I'm trying to get all Institutions by listOfWhomHelp.
I expected all records(institutions) which contain listOfWhomHelp, but if I choose more than one element in listOfWhomHelp it throws me:



java.sql.SQLException: Operand should contain 1 column(s)
com.mysql.jdbc.SQLError.createSQLException(SQLError.java:963)


Repository method



List<Institution> findAllByWhomHelp(List<InstitutionListOfWhomHelp> institutionListOfWhomHelp);


Service method



public List<Institution> findInstitutions(Institution institution) throws NullPointerException 

if(institution.getInstitutionLocations().isEmpty())
return institutionRepository.findAllByWhomHelp(institution.getWhomHelp());




There is also list of InstitutionLocation, but I always choose on of them



Institution



@NotEmpty
@ManyToMany
private List<InstitutionListOfWhomHelp> whomHelp;


InstitutionListOfWhomHelp



@NotBlank
private String whomHelp;

@ManyToMany(mappedBy = "whomHelp")
private List<Institution> institution;









share|improve this question
























  • don't you think it should use ! like ` if(! institution.getWhomHelp().isEmpty()) return institutionRepository.findAllByWhomHelp(institution.getWhomHelp()); `

    – RAHUL ROY
    Mar 26 at 5:03












  • you can check here or here.

    – RAHUL ROY
    Mar 26 at 5:07











  • But the problem is that institution.getWhomHelp() isn't empty - i checked this before.This is the way when list institution.getInstitutionLocations() is empty and whomHelp isn't. I've also take care of NullPointerException

    – Michał Tomala
    Mar 26 at 6:03

















2















I'm using Spring Data for select operation on MySql DataBase.



I'm trying to get all Institutions by listOfWhomHelp.
I expected all records(institutions) which contain listOfWhomHelp, but if I choose more than one element in listOfWhomHelp it throws me:



java.sql.SQLException: Operand should contain 1 column(s)
com.mysql.jdbc.SQLError.createSQLException(SQLError.java:963)


Repository method



List<Institution> findAllByWhomHelp(List<InstitutionListOfWhomHelp> institutionListOfWhomHelp);


Service method



public List<Institution> findInstitutions(Institution institution) throws NullPointerException 

if(institution.getInstitutionLocations().isEmpty())
return institutionRepository.findAllByWhomHelp(institution.getWhomHelp());




There is also list of InstitutionLocation, but I always choose on of them



Institution



@NotEmpty
@ManyToMany
private List<InstitutionListOfWhomHelp> whomHelp;


InstitutionListOfWhomHelp



@NotBlank
private String whomHelp;

@ManyToMany(mappedBy = "whomHelp")
private List<Institution> institution;









share|improve this question
























  • don't you think it should use ! like ` if(! institution.getWhomHelp().isEmpty()) return institutionRepository.findAllByWhomHelp(institution.getWhomHelp()); `

    – RAHUL ROY
    Mar 26 at 5:03












  • you can check here or here.

    – RAHUL ROY
    Mar 26 at 5:07











  • But the problem is that institution.getWhomHelp() isn't empty - i checked this before.This is the way when list institution.getInstitutionLocations() is empty and whomHelp isn't. I've also take care of NullPointerException

    – Michał Tomala
    Mar 26 at 6:03













2












2








2








I'm using Spring Data for select operation on MySql DataBase.



I'm trying to get all Institutions by listOfWhomHelp.
I expected all records(institutions) which contain listOfWhomHelp, but if I choose more than one element in listOfWhomHelp it throws me:



java.sql.SQLException: Operand should contain 1 column(s)
com.mysql.jdbc.SQLError.createSQLException(SQLError.java:963)


Repository method



List<Institution> findAllByWhomHelp(List<InstitutionListOfWhomHelp> institutionListOfWhomHelp);


Service method



public List<Institution> findInstitutions(Institution institution) throws NullPointerException 

if(institution.getInstitutionLocations().isEmpty())
return institutionRepository.findAllByWhomHelp(institution.getWhomHelp());




There is also list of InstitutionLocation, but I always choose on of them



Institution



@NotEmpty
@ManyToMany
private List<InstitutionListOfWhomHelp> whomHelp;


InstitutionListOfWhomHelp



@NotBlank
private String whomHelp;

@ManyToMany(mappedBy = "whomHelp")
private List<Institution> institution;









share|improve this question
















I'm using Spring Data for select operation on MySql DataBase.



I'm trying to get all Institutions by listOfWhomHelp.
I expected all records(institutions) which contain listOfWhomHelp, but if I choose more than one element in listOfWhomHelp it throws me:



java.sql.SQLException: Operand should contain 1 column(s)
com.mysql.jdbc.SQLError.createSQLException(SQLError.java:963)


Repository method



List<Institution> findAllByWhomHelp(List<InstitutionListOfWhomHelp> institutionListOfWhomHelp);


Service method



public List<Institution> findInstitutions(Institution institution) throws NullPointerException 

if(institution.getInstitutionLocations().isEmpty())
return institutionRepository.findAllByWhomHelp(institution.getWhomHelp());




There is also list of InstitutionLocation, but I always choose on of them



Institution



@NotEmpty
@ManyToMany
private List<InstitutionListOfWhomHelp> whomHelp;


InstitutionListOfWhomHelp



@NotBlank
private String whomHelp;

@ManyToMany(mappedBy = "whomHelp")
private List<Institution> institution;






java mysql hibernate jpa spring-data






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 5:42









Ali Azim

11813 bronze badges




11813 bronze badges










asked Mar 26 at 4:56









Michał TomalaMichał Tomala

132 bronze badges




132 bronze badges












  • don't you think it should use ! like ` if(! institution.getWhomHelp().isEmpty()) return institutionRepository.findAllByWhomHelp(institution.getWhomHelp()); `

    – RAHUL ROY
    Mar 26 at 5:03












  • you can check here or here.

    – RAHUL ROY
    Mar 26 at 5:07











  • But the problem is that institution.getWhomHelp() isn't empty - i checked this before.This is the way when list institution.getInstitutionLocations() is empty and whomHelp isn't. I've also take care of NullPointerException

    – Michał Tomala
    Mar 26 at 6:03

















  • don't you think it should use ! like ` if(! institution.getWhomHelp().isEmpty()) return institutionRepository.findAllByWhomHelp(institution.getWhomHelp()); `

    – RAHUL ROY
    Mar 26 at 5:03












  • you can check here or here.

    – RAHUL ROY
    Mar 26 at 5:07











  • But the problem is that institution.getWhomHelp() isn't empty - i checked this before.This is the way when list institution.getInstitutionLocations() is empty and whomHelp isn't. I've also take care of NullPointerException

    – Michał Tomala
    Mar 26 at 6:03
















don't you think it should use ! like ` if(! institution.getWhomHelp().isEmpty()) return institutionRepository.findAllByWhomHelp(institution.getWhomHelp()); `

– RAHUL ROY
Mar 26 at 5:03






don't you think it should use ! like ` if(! institution.getWhomHelp().isEmpty()) return institutionRepository.findAllByWhomHelp(institution.getWhomHelp()); `

– RAHUL ROY
Mar 26 at 5:03














you can check here or here.

– RAHUL ROY
Mar 26 at 5:07





you can check here or here.

– RAHUL ROY
Mar 26 at 5:07













But the problem is that institution.getWhomHelp() isn't empty - i checked this before.This is the way when list institution.getInstitutionLocations() is empty and whomHelp isn't. I've also take care of NullPointerException

– Michał Tomala
Mar 26 at 6:03





But the problem is that institution.getWhomHelp() isn't empty - i checked this before.This is the way when list institution.getInstitutionLocations() is empty and whomHelp isn't. I've also take care of NullPointerException

– Michał Tomala
Mar 26 at 6:03












1 Answer
1






active

oldest

votes


















1














Can you try like bottom



instituonRepository.findAllByWhomHelpIn


Thanks






share|improve this answer























  • It's working ,really thank you !!

    – Michał Tomala
    Mar 26 at 8:26










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55350088%2fproblem-with-sql-java-sql-sqlexception-operand-should-contain-1-columns-on%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Can you try like bottom



instituonRepository.findAllByWhomHelpIn


Thanks






share|improve this answer























  • It's working ,really thank you !!

    – Michał Tomala
    Mar 26 at 8:26















1














Can you try like bottom



instituonRepository.findAllByWhomHelpIn


Thanks






share|improve this answer























  • It's working ,really thank you !!

    – Michał Tomala
    Mar 26 at 8:26













1












1








1







Can you try like bottom



instituonRepository.findAllByWhomHelpIn


Thanks






share|improve this answer













Can you try like bottom



instituonRepository.findAllByWhomHelpIn


Thanks







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 26 at 7:15









Musa AyMusa Ay

1314 bronze badges




1314 bronze badges












  • It's working ,really thank you !!

    – Michał Tomala
    Mar 26 at 8:26

















  • It's working ,really thank you !!

    – Michał Tomala
    Mar 26 at 8:26
















It's working ,really thank you !!

– Michał Tomala
Mar 26 at 8:26





It's working ,really thank you !!

– Michał Tomala
Mar 26 at 8:26








Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid …


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55350088%2fproblem-with-sql-java-sql-sqlexception-operand-should-contain-1-columns-on%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to preserve electronics (computers, tablets and phones) for hundreds of years Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) The network's official Twitter account is up and running again. What content…How might modern humans leave a message for 50,000 years?How would an aquatic race develop computers?How do we make computers care for human life?Keeping supplies for 1000 yearsWhat will cell phones become in 100 years?What body armor protects against a laser?Could a society attain 1800s technology if limited to using copper and bronze?Electricity power (magic) and electronicsScavenging metal resources in post-apocalypse after 100 yearsWhy would precursors create devices that can survive and still work after hundreds of years?

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해

Convert JSON to MapSimplest way to convert a string representing JSON array into Java array List of key value pairsHow to take String JSON values into HashMapConvert a JSON String to a HashMapCreating BSON object from JSON stringJSONObject - How to get a value ?Better Map ConstructorReading JSON from Url javaUpdate columns if input values are not null otherwise ignore and keep the existing values of column in databaseHow to store object represented as Json string into Couchbase Lite?Go JSON into MapHow do I efficiently iterate over each entry in a Java Map?Sort a Map<Key, Value> by valuesHow to round a number to n decimal places in JavaCan comments be used in JSON?How do I read / convert an InputStream into a String in Java?How can I pretty-print JSON in a shell script?What is the correct JSON content type?How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?Why does Google prepend while(1); to their JSON responses?Parse JSON in JavaScript?